-
Notifications
You must be signed in to change notification settings - Fork 397
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 enable profiling? #398
Comments
This not supported at the moment. How does ocamlprof work, do you just replace ocamlc (ocamlopt?) by ocamlprof? |
Not exactly: you replace ocamlc with ocamlcp (and ocamlopt with ocamloptp). |
Ok, this seems like a good fit for #391 |
You can ping me if it gets implemented, I will test its use for profiling. |
+1. Support for profiling would be great. |
@diml It might be possible to also address this with our cross compilation ability. Off the top of my head, it should be possible to define a target "profiling" context that replaces ocamlc and ocamlopt with their profiling alternatives. It's a bit annoying that this has to be accomplished through findlib toolchains, but this should all be possible now. The nice thing is also that you'll be building your profiled binaries using efficient preprocessors. |
Ah, that's true. I think there should still be a way to use profiling without talking about cross-compilation (at least for configuring it) as it feels a bit weird, but in the meantime that's a good way to do it. So, the following should work with the tip of jbuilder:
And the build artifacts will be stored in |
there is no profiling.conf file in my ~/.opam |
Yes, that's expected. I'm suggesting to create one with this contents:
|
Were there any updates on this matter? |
Nope. Have you try the suggested workaround? Moving forward, this functionality could be exposed via the |
The code snipped above seems to use a |
Yh, you need to create it manually if it doesn't exist. I think we should just add a configuration option for this. |
How about adding the
|
It's not as simple as setting a profile. This requires setting up a host/target context setup which is done via workspaces. I suppose we do this setup when the |
My current workflow to get profiling is:
|
@lindig your current solution sounds quite good to me. In fact, I'm not even sure how we could improve it in dune. I suppose we could add a Could you comment on your workflow with Regarding bisect_ppx, it's a bit of a separate question. We'll definitely have a specialized profile for that. It's just that there are some complications in implementing it. It does not affect gprof, ocamlcp, etc. |
I have never used
ocamloptp does not accept Not sure it is relevant: ocamloptp is implemented as an instrumentation phase: |
I confirm that @diml's suggestion creates a profiling exe in _build/default.profiling/src/program.exe |
Not that for time profiling, there are some info there:
|
Until I read through all of the comments here and tried the nth suggestion (thanks @lindig), my impression was that getting time profiling via dune was not readily possible. So, just a suggestion: insofar as adding an easy |
It seems that OCaml 4.09 no longer supports |
Could somebody confirm that with OCaml 4.09 it becomes impractical to profile dune-based projects? The argument for removing gprof support is:
|
It would be nice if the dune documentation tells us what is the currently supported way to profile a program. |
Agreed |
I would like to use ocamlprof.
Could not find in the manual.
Thanks,
F.
The text was updated successfully, but these errors were encountered: