Currently, we can do sampling based profiling. But how can we do instrumentation based profiling?
In gcc, there are
-finstrument-functions options for generating a special instruction for entries of functions. And the instruction is utilized for profiling.
Also, LLVM has similar thing called to
Is there no way to generate those instructions like them in rustc?
If there is no way, I think that we must consider adding the way to rustc.
There's https://github.com/llogiq/flamer which does something similar.
Thanks to your reply!
flamer is somewhat similar to what I want.
But, it is not enough and has limitations.
- Need to modify existing codes.
- We must add some codes to all .rs files for using
- Only supports
flamer only supports
flame. It is not flexible.
-finstrument-function options add a special call instruction to every functions. And instrumentation based profilers work by hooking the called function to their functions.
It is very flexible and extendable way.
I think this feature should be added to
It was addressed in https://github.com/rust-lang/rust/pull/57220!!
And we may be able to use that feature in next rust release.