[Mono-dev] Profiler extension

Massimiliano Mantione massi at ximian.com
Sun Jul 20 10:59:14 EDT 2008


Hello!

Rodrigo and others were asking to extend the stat profiler to recognize
also trampolines and thunks (right now they show up as "unknown").

I have looked at the code, and found that the different categories of
"thunks" we have are, roughly:

- create_fnptr
- load_aot_method
- imt thunk
- jump table
- debugger code
- exception call filter
- trampoline (various types)
- throw corlib exception
- restore context
- throw exception by name
- handle stack overflow
- throw exception
- delegate invoke implementation
- cpuid code :-)

There are more than 70 places in the code that reserve memory from a
code manager to produce those small code snippets that we'd like to
track.

Typically, when we add profiling infrastructure, we do not change the
runtime API, we just insert calls to the profiler APIs in the relevant
places.
However, in this case I'd really, really prefer to:
- create an enum with all the "thunk categories" above,
- add it as a parameter to "mono_code_manager_reserve*" functions, and
- call the new profiler API from there.
This will make the code more compact (without those 70+ calls to
profiler APIs scattered around), will make sure I don't miss any spot,
and (most important) will make sure that future code maintenance will
not forget to call the profiler API as well.

But before doing that I wanted to know if changing the code manager API
was OK...

Ciao,
  Massi




More information about the Mono-devel-list mailing list