-
Notifications
You must be signed in to change notification settings - Fork 697
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
How to profile? #5930
Comments
It's quite simple actually :-) There's two ways of operation here: either you can operate in the non-stateful way, then you need to explicitly pass the
or you can persist those settings by invoking
which will merely create a file
and then you don't need to explicitly pass I hope this clears this up. Feel free to ask follow-up questions if something's still unclear. |
Many thanks, Herbert. That makes sense. (It would be good if the cabal documentation made the basic conventions clear; they seem obvious once they are explained but the cabal manual doesn't do a great job of explaining the underlying concepts (eg, when to drive and persist through the command line and when to put things into the cabal file). |
This doesn't work for me. I built with the following config:
When running the executable with Edit: I'm using |
Same issues as @hausfell; I'm building for Windows, and I've tried a few permutations of the ghc-options listed above without luck. |
@Achierius did you try to run |
I put some
As far as I can tell, the Moreover, I receive a warning Warning: 'ghc-options: -prof' is not necessary and will lead to problems when but when I delete the flag (I have it in my cabal file, for the executable), I receive an error from ghc upon running readFilePerformance: the flag -hc requires the program to be built with -prof I am completely confused now, especially regarding the SCC pragmas. Some heap profiling is going on, though. |
@rubenmoor: as you can see in comments above, you need If that still doesn't work, you may have more luck with |
@rubenmoor; unless you only want to perform heap profiling with |
@rubenmoor: and you usually don't want to both |
I use |
Let me check in the user guide: https://downloads.haskell.org/ghc/latest/docs/html/users_guide/profiling.html#profiling-memory-usage It seems, for the heap profiler to use your cost centre (for restricting what it profiles, there seems to be no other use), you need to give the cost centre name as argument to |
This issue seems to have outlived its time here: the original question has been answered, and the follow-ups seem to have been abandoned. For posterity, the short answer is: create a
Nothing else. Check out the profiling-related documentation in the manual. I suggest we close. |
I exactly followed the instructions (creating a cabal.project.local file with "profiling: True" and "profiling-detail: all-functions"). However, after running "cabal run" I cannot find any .prof file. And worse, no error message appears, everything running through as usual. |
@ratschan you're right: it is a bit confusing. The tail of the discussion above was devoted mostly to building code with profiling information included. What you're asking is how to run code so that you get the actual run-time information. Here's an augmented answer: after setting up your
|
Great, that works, thanks a lot! |
Perhaps this is a documentation issue, but when I run something like
cabal v2-bench --enable-profiling
the benchmark runs, but produces no profiling output that I can see. If I run withcabal v2-run +RTS -p
I get thethe flag -p requires the program to be built with -prof
error. Perhaps the bench and run executables are pointing at different things and perhaps the profiling output is buried somewhere, but the out of the box experience is suboptimal.The text was updated successfully, but these errors were encountered: