<?xml version="1.0" encoding="us-ascii"?><span> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>mono-api-profiler.html</title> <style type="text/css"> h3 { font-size: 18px; padding-bottom: 4pt; border-bottom: 2px solid #dddddd; } .api { border: 1px solid; padding: 10pt; margin: 10pt; } .api-entry { border-bottom: none; font-size: 18px; } .prototype { border: 1px solid; background-color: #f2f2f2; padding: 5pt; margin-top: 5pt; margin-bottom: 5pt; } .header { border: 1px solid; padding: 0 0 5pt 5pt; margin: 10pt; white-space: pre; font-family: monospace; } .code { border: 1px solid; padding: 0 0 5pt 5pt; margin: 10pt; white-space: pre; font-family: monospace; } </style> </head> <body> <h1>Profiling Interface</h1> <h3>Profiler Operation</h3> <p />The following methods can be used by dynamic profiler methods to monitor different aspects of the program. <p />A custom profiler will have one public method defined in the shared library which is the entry point that Mono calls at startup, it has the following signature: <pre> void mono_profiler_startup (const char *desc) </pre> <p />Where "desc" is the set of arguments that were passed from the command line. This routine will call <tt>mono_profiler_install</tt> to activate the profiler and will install one or more filters (one of the various <tt>mono_profiler_install_</tt> functions). <p />In addition, a profiler developer will typically call <tt>mono_profiler_set_events</tt> to register which kinds of traces should be enabled, these can be an OR-ed combination of the following: <pre> MONO_PROFILE_NONE MONO_PROFILE_APPDOMAIN_EVENTS MONO_PROFILE_ASSEMBLY_EVENTS MONO_PROFILE_MODULE_EVENTS MONO_PROFILE_CLASS_EVENTS MONO_PROFILE_JIT_COMPILATION MONO_PROFILE_INLINING MONO_PROFILE_EXCEPTIONS MONO_PROFILE_ALLOCATIONS MONO_PROFILE_GC MONO_PROFILE_THREADS MONO_PROFILE_REMOTING MONO_PROFILE_TRANSITIONS MONO_PROFILE_ENTER_LEAVE MONO_PROFILE_COVERAGE MONO_PROFILE_INS_COVERAGE MONO_PROFILE_STATISTICAL </pre> <p />Developers can change the set of monitored events at runtime by calling <tt>mono_profiler_set_events</tt>. <a name="api:mono_profiler_install"></a> <div class="api"> <div class="api-entry">mono_profiler_install</div> <div class="prototype">void mono_profiler_install (MonoProfiler *prof, MonoProfileFunc callback) </div> <p /> <b>Parameters</b> <blockquote><dt><i>prof:</i></dt><dd> a MonoProfiler structure pointer, or a pointer to a derived structure.</dd><dt><i>callback:</i></dt><dd> the function to invoke at shutdown</dd></blockquote> <b>Remarks</b> <p /> Use mono_profiler_install to activate profiling in the Mono runtime. Typically developers of new profilers will create a new structure whose first field is a MonoProfiler and put any extra information that they need to access from the various profiling callbacks there. </div> <a name="api:mono_profiler_install_allocation"></a> <div class="api"> <div class="api-entry">mono_profiler_install_allocation</div> <div class="prototype">Prototype: mono_profiler_install_allocation</div> <p /> </div> <a name="api:mono_profiler_install_appdomain"></a> <div class="api"> <div class="api-entry">mono_profiler_install_appdomain</div> <div class="prototype">Prototype: mono_profiler_install_appdomain</div> <p /> </div> <a name="api:mono_profiler_install_assembly"></a> <div class="api"> <div class="api-entry">mono_profiler_install_assembly</div> <div class="prototype">Prototype: mono_profiler_install_assembly</div> <p /> </div> <a name="api:mono_profiler_install_class"></a> <div class="api"> <div class="api-entry">mono_profiler_install_class</div> <div class="prototype">Prototype: mono_profiler_install_class</div> <p /> </div> <a name="api:mono_profiler_install_coverage_filter"></a> <div class="api"> <div class="api-entry">mono_profiler_install_coverage_filter</div> <div class="prototype">Prototype: mono_profiler_install_coverage_filter</div> <p /> </div> <a name="api:mono_profiler_install_enter_leave"></a> <div class="api"> <div class="api-entry">mono_profiler_install_enter_leave</div> <div class="prototype">void mono_profiler_install_enter_leave (MonoProfileMethodFunc enter, MonoProfileMethodFunc fleave) </div> <p /> <b>Parameters</b> <blockquote><dt><i>enter:</i></dt><dd> the routine to be called on each method entry</dd><dt><i>fleave:</i></dt><dd> the routine to be called each time a method returns</dd></blockquote> <b>Remarks</b> <p /> Use this routine to install routines that will be called everytime a method enters and leaves. The routines will receive as an argument the MonoMethod representing the method that is entering or leaving. </div> <a name="api:mono_profiler_install_jit_compile"></a> <div class="api"> <div class="api-entry">mono_profiler_install_jit_compile</div> <div class="prototype">void mono_profiler_install_jit_compile (MonoProfileMethodFunc start, MonoProfileMethodResult end) </div> <p /> <b>Parameters</b> <blockquote><dt><i>start:</i></dt><dd> the routine to be called when the JIT process starts.</dd><dt><i>end:</i></dt><dd> the routine to be called when the JIT process ends.</dd></blockquote> <b>Remarks</b> <p /> Use this routine to install routines that will be called when JIT compilation of a method starts and completes. </div> <a name="api:mono_profiler_install_module"></a> <div class="api"> <div class="api-entry">mono_profiler_install_module</div> <div class="prototype">Prototype: mono_profiler_install_module</div> <p /> </div> <a name="api:mono_profiler_install_thread"></a> <div class="api"> <div class="api-entry">mono_profiler_install_thread</div> <div class="prototype">Prototype: mono_profiler_install_thread</div> <p /> </div> <a name="api:mono_profiler_install_transition"></a> <div class="api"> <div class="api-entry">mono_profiler_install_transition</div> <div class="prototype">Prototype: mono_profiler_install_transition</div> <p /> </div> <a name="api:mono_profiler_install_gc"></a> <div class="api"> <div class="api-entry">mono_profiler_install_gc</div> <div class="prototype">Prototype: mono_profiler_install_gc</div> <p /> </div> <a name="api:mono_profiler_install_statistical"></a> <div class="api"> <div class="api-entry">mono_profiler_install_statistical</div> <div class="prototype">Prototype: mono_profiler_install_statistical</div> <p /> </div> <a name="api:mono_profiler_set_events"></a> <div class="api"> <div class="api-entry">mono_profiler_set_events</div> <div class="prototype">void mono_profiler_set_events (MonoProfileFlags events) </div> <p /> <b>Parameters</b> <blockquote><dt><i>events:</i></dt><dd> an ORed set of values made up of MONO_PROFILER_ flags</dd></blockquote> <b>Remarks</b> <p /> The events descriped in the <i>events</i> argument is a set of flags that represent which profiling events must be triggered. For example if you have registered a set of methods for tracking JIT compilation start and end with mono_profiler_install_jit_compile, you will want to pass the MONO_PROFILE_JIT_COMPILATION flag to this routine. You can call mono_profile_set_events more than once and you can do this at runtime to modify which methods are invoked. </div> <a name="api:mono_profiler_get_events"></a> <div class="api"> <div class="api-entry">mono_profiler_get_events</div> <div class="prototype">MonoProfileFlags mono_profiler_get_events (void) </div> <p /> <b>Remarks</b> <p /> Returns a list of active events that will be intercepted. </div><h3>Coverage</h3> <p />To support profiling modules that need to do code coverage analysis, the following routines is provided: </body> </html> </span>