Available on crate feature
coreclr only.Expand description
A minimal CoreCLR profiler, implemented as COM objects by hand.
Registered as a startup profiler (the host sets CORECLR_ENABLE_PROFILING=1,
CORECLR_PROFILER={CLSID_STRING} and CORECLR_PROFILER_PATH to the
.so that re-exports dll_get_class_object as DllGetClassObject), the
runtime loads it and calls ICorProfilerCallback::Initialize, where we grab
ICorProfilerInfo and ask to monitor JIT compilation and to enable ReJIT.
This is the registration layer. ReJIT (replacing a method’s IL with hao’s)
and native code-address lookup (for patching machine code with iced) build
on the ICorProfilerInfo captured here.
COM on Linux uses the C calling convention; every callback returns an
HRESULT, so unused vtable slots share one stub that returns S_OK.
Structs§
- Guid
- A COM interface id / class id.
Constants§
- CLSID_
STRING - The string form of our profiler CLSID, for
CORECLR_PROFILER.
Functions§
- dll_
get_ ⚠class_ object - The entry CoreCLR looks up by name in the profiler library. A host re-exports
it as
DllGetClassObject. - native_
code - The native code address and size of a method, for patching it in place (for
example with
iced).module_substringmatches a loaded module’s name, andtokenis the method’s metadata token (mdMethodDef). ReturnsNoneuntil the method has been JIT-compiled. - watch_
module - Log JITed methods of modules whose name contains
substring(e.g. the game assembly). Without this, module loads are still logged but JITs are not.