Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haskell GHC JSON format support (fixes #182) #183

Merged
merged 7 commits into from Oct 29, 2018

Conversation

@trishume
Copy link
Contributor

@trishume trishume commented Oct 25, 2018

Fixes #182 by adding support for importing the JSON profiling format created by GHC's built in profiling support when the executable is passed the -pj option. Produces a profile group containing both a time and allocation profile.

Unfortunately, GHC doesn't provide the raw sample information to get the time view to be useful, so only left heavy and sandwich are useful.

Includes a test profile, and I've also tested it on a more real large 2MB profile file in the UI and it works great.

I also modified the Readme to link to a wiki page I'm unable to create, but that should have something like this content copy-pasted into it:

Importing from Haskell

GHC provides built in profiling support that can export a JSON file.
In order to do this you need to compile your executable with profiling
support and then pass the -pj RTS flag to the executable.

This will produce a my-binary.prof file in the current directory which
you can import into speedscope.

Using GHC

See the GHC manual page on profiling
for more extensive information on the command line flags available.

$ ghc -prof -fprof-auto -rtsopts Main.hs
$ ./Main +RTS -pj -RTS

Using Stack

With executables

$ stack build --profile
$ stack exec -- my-executable +RTS -pj -RTS

With tests

stack test --profile --test-arguments "+RTS -pj -RTS"
@coveralls
Copy link

@coveralls coveralls commented Oct 26, 2018

Coverage Status

Coverage increased (+0.4%) to 44.868% when pulling 08bb744 on trishume:haskell-support into 86f4ba6 on jlfwong:master.

Copy link
Owner

@jlfwong jlfwong left a comment

Thanks for doing this! 🎉

This looks great. If you accept the suggested changes, then I think this should be good to merge. Once that's done, I'll update the wiki, deploy, and publish the new version to npm.

src/import/haskell.ts Outdated Show resolved Hide resolved
src/import/haskell.ts Outdated Show resolved Hide resolved
src/import/haskell.ts Outdated Show resolved Hide resolved
jlfwong and others added 3 commits Oct 26, 2018
Co-Authored-By: trishume <tris.hume@gmail.com>
Co-Authored-By: trishume <tris.hume@gmail.com>
Co-Authored-By: trishume <tris.hume@gmail.com>
@trishume
Copy link
Contributor Author

@trishume trishume commented Oct 26, 2018

Thanks, suggestions applied, such a great new feature.

Although I wish there was a way to apply multiple suggestions in one commit 😐. I wonder if until they add that ability there will be a surge in maintainers using the squash before merging strategy...

@jlfwong jlfwong merged commit e35335f into jlfwong:master Oct 29, 2018
2 checks passed
@jlfwong
Copy link
Owner

@jlfwong jlfwong commented Oct 29, 2018

Thanks @trishume! This is now merged, published to npm, and deployed to https://www.speedscope.app/. I also added the documentation you wrote to the wiki: https://github.com/jlfwong/speedscope/wiki/Importing-from-Haskell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants