Notifies the profiler that a search has started for a function that was compiled previously using the Native Image Generator (NGen.exe).
HRESULT JITCachedFunctionSearchStarted( [in] FunctionID functionId, [out] BOOL *pbUseCachedFunction);
[in] The ID of the function for which the search is being performed.
true if the execution engine should use the cached version of a function (if available); otherwise
false. If the value is
false, the execution engine JIT-compiles the function instead of using a version that is not JIT-compiled.
In the .NET Framework version 2.0, the
JITCachedFunctionSearchStarted and ICorProfilerCallback::JITCachedFunctionSearchFinished Method callbacks will not be made for all functions in regular NGen images. Only NGen images optimized for a profile will generate callbacks for all functions in the image. However, due to the additional overhead, a profiler should request profiler-optimized NGen images only if it intends to use these callbacks to force a function to be compiled just-in-time (JIT). Otherwise, the profiler should use a lazy strategy for gathering function information.
Profilers must support cases where multiple threads of a profiled application are calling the same method simultaneously. For example, thread A calls
JITCachedFunctionSearchStarted and the profiler responds by setting pbUseCachedFunctionto FALSE to force JIT compilation. Thread A then calls ICorProfilerCallback::JITCompilationStarted and ICorProfilerCallback::JITCompilationFinished.
Now thread B calls
JITCachedFunctionSearchStarted for the same function. Even though the profiler has stated its intention to JIT-compile the function, the profiler receives the second callback because thread B sends the callback before the profiler has responded to thread A's call to
JITCachedFunctionSearchStarted. The order in which the threads make calls depends on how the threads are scheduled.
When the profiler receives duplicate callbacks, it must set the value referenced by
pbUseCachedFunction to the same value for all the duplicate callbacks. That is, when
JITCachedFunctionSearchStarted is called multiple times with the same
functionId value, the profiler must respond the same each time.
Platforms: See System Requirements.
Header: CorProf.idl, CorProf.h
.NET Framework Versions: Available since 2.0
Send feedback about: