Add counters to profiler (for CFG spill and reload instructions)#2786
Add counters to profiler (for CFG spill and reload instructions)#2786milan-tom merged 17 commits intooxcaml:mainfrom
Conversation
xclerc
left a comment
There was a problem hiding this comment.
I think it would be worthwhile to also
amend /ocaml/driver/compenv.ml
(in particular the read_one_param
function), so that the new behavior
can also be requested through the
OCAMLRUNPARAM environment
variable.
|
(@gretay-js will also review) |
Co-authored-by: Xavier Clerc <xclerc@users.noreply.github.com>
3cf38c2 to
01a0abf
Compare
Done. |
|
Thanks - there was a typo in my comment, |
…table by OCAMLPARAM
0717ccf to
ea7df88
Compare
Corrected in commit name. |
9585a3e to
3dc187e
Compare
xclerc
left a comment
There was a problem hiding this comment.
If you can confirm that the output
of -dtimings is unaffected when
-dcounters is not passed, I think
it is good to go.
(@gretay-js also suggested off-line
it would be useful to give an
example of the new output in the
description of the pull request.)
…nstructions) (oxcaml#2786) * Add counter column to profiler * Add option for function level profiling * Implement CFG spill and reload counter functionality * Clean up formatting * Always print ancestors of stages determined worth displaying * Remove unnecessary string to int conversion Co-authored-by: Xavier Clerc <xclerc@users.noreply.github.com> * Prevent Counter methods from raising exceptions * Only compute counters if requested by user * Avoid underscore in function name * Fix accumulation of counters * Correct reference to Function_level in codegen_main.ml * Change -dfunc-level to -dgranularity and make profile granularity settable by OCAMLPARAM * Remove catch-all pattern for profile granularity * Fix dynamic linking dependencies * Accumulate spill and reload counts locally before passing to Counter * Improve readability of profile wrapper for function declaration compilation * Move counter profiling for regalloc outside pipeline --------- Co-authored-by: Xavier Clerc <xclerc@users.noreply.github.com>
This PR introduces the ability to measure certain values as counters during passes of the compiler.
Options for API:
Profile.recordfunction with optional?counter_fargumentno longer match interfaces.
Profile.record_with_countersfunctioncouter_fargument.timing and memory are difference measures between the start and end of the stage and have a fixed
number of measures whereas counters are purely based on the result of a stage and there may be
many counters).
-dprofileoption (need to manage integration of the two profilingmechanisms)
The current implementation uses option 2.
Examples of new outputs
-dcounters-dcounters -dgranularity func-dtimings -dgranularity func