Add Runtime Async profiler API coverage - #131988
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 4 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Adds two new in-tree profiler tests under src/tests/profiler/ to exercise “Runtime Async” profiler behaviors, with corresponding native profiler implementations wired into the shared native test profiler.
Changes:
- Adds managed profilee executables
runtimeasyncapisandruntimeasynctypesthat run underProfilerTestRunnerwithDOTNET_RuntimeAsync=1. - Adds native profilers
RuntimeAsyncApisProfilerandRuntimeAsyncTypesProfilerand wires them into the native test profiler build andClassFactory. - Extends the native profiler CMake sources list to compile the new profiler implementations.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/profiler/runtimeasynctypes/runtimeasynctypes.csproj | New managed test project enabling runtime-async feature. |
| src/tests/profiler/runtimeasynctypes/runtimeasynctypes.cs | New managed profilee driving GC/continuation scenarios. |
| src/tests/profiler/runtimeasyncapis/runtimeasyncapis.csproj | New managed test project enabling runtime-async feature. |
| src/tests/profiler/runtimeasyncapis/runtimeasyncapis.cs | New managed profilee driving JIT/exception scenarios. |
| src/tests/profiler/native/runtimeasynctypes/runtimeasynctypesprofiler.h | Declares native profiler collecting class-load/GC graph observations. |
| src/tests/profiler/native/runtimeasynctypes/runtimeasynctypesprofiler.cpp | Implements runtime-async type/GC traversal checks and pass/fail output. |
| src/tests/profiler/native/runtimeasyncapis/runtimeasyncapisprofiler.h | Declares native profiler collecting JIT/IP/mapping/exception callback observations. |
| src/tests/profiler/native/runtimeasyncapis/runtimeasyncapisprofiler.cpp | Implements runtime-async API checks and pass/fail output. |
| src/tests/profiler/native/CMakeLists.txt | Builds the new native profiler sources. |
| src/tests/profiler/native/classfactory.cpp | Adds CLSID routing to construct the new profiler instances. |
Suppressed comments (9)
src/tests/profiler/native/runtimeasynctypes/runtimeasynctypesprofiler.cpp:55
- Profiler callbacks should use
SHUTDOWNGUARD()to avoid work during/after shutdown (this override currently bypasses the base implementation’s shutdown protection).
HRESULT RuntimeAsyncTypesProfiler::ClassLoadFinished(ClassID classId, HRESULT hrStatus)
{
_classLoadFinishes++;
{
src/tests/profiler/native/runtimeasynctypes/runtimeasynctypesprofiler.cpp:158
- Profiler callbacks should use
SHUTDOWNGUARD()to avoid work during/after shutdown (consistent with other GC-related profilers undersrc/tests/profiler/native).
HRESULT RuntimeAsyncTypesProfiler::GarbageCollectionStarted(
int cGenerations, BOOL generationCollected[], COR_PRF_GC_REASON reason)
{
_gcStarts++;
std::lock_guard<std::mutex> lock(_stateLock);
src/tests/profiler/native/runtimeasynctypes/runtimeasynctypesprofiler.cpp:168
- Profiler callbacks should use
SHUTDOWNGUARD()to avoid accessing profiler state after shutdown has started.
HRESULT RuntimeAsyncTypesProfiler::ObjectReferences(
ObjectID objectId, ClassID classId, ULONG cObjectRefs, ObjectID objectRefIds[])
{
bool metadataLess = CheckContinuationApis(classId);
src/tests/profiler/native/runtimeasynctypes/runtimeasynctypesprofiler.cpp:215
- Profiler callbacks should use
SHUTDOWNGUARD()(see other profilers in this directory) to avoid running during/after shutdown.
HRESULT RuntimeAsyncTypesProfiler::GarbageCollectionFinished()
{
AnalyzeObjectGraph();
return S_OK;
src/tests/profiler/native/runtimeasyncapis/runtimeasyncapisprofiler.cpp:66
- Profiler callbacks should use
SHUTDOWNGUARD()to avoid calling intopCorProfilerInfoafter shutdown has started.
HRESULT RuntimeAsyncApisProfiler::JITCompilationFinished(
FunctionID functionId, HRESULT hrStatus, BOOL fIsSafeToBlock)
{
if (!IsTarget(functionId))
{
return S_OK;
}
src/tests/profiler/native/runtimeasyncapis/runtimeasyncapisprofiler.cpp:121
- Profiler callbacks should use
SHUTDOWNGUARD()to avoid running after shutdown has started.
HRESULT RuntimeAsyncApisProfiler::ExceptionThrown(ObjectID thrownObjectId)
{
_exceptionsThrown++;
return S_OK;
src/tests/profiler/native/runtimeasyncapis/runtimeasyncapisprofiler.cpp:129
- Profiler callbacks should use
SHUTDOWNGUARD()to avoid reading profiler state during/after shutdown.
HRESULT RuntimeAsyncApisProfiler::ExceptionSearchFunctionEnter(FunctionID functionId)
{
if (functionId == _target.load())
{
_targetSearches++;
}
src/tests/profiler/native/runtimeasyncapis/runtimeasyncapisprofiler.cpp:138
- Profiler callbacks should use
SHUTDOWNGUARD()to avoid reading profiler state during/after shutdown.
HRESULT RuntimeAsyncApisProfiler::ExceptionUnwindFunctionEnter(FunctionID functionId)
{
if (functionId == _target.load())
{
_targetUnwinds++;
}
src/tests/profiler/native/runtimeasyncapis/runtimeasyncapisprofiler.cpp:145
- Profiler callbacks should use
SHUTDOWNGUARD()to avoid running after shutdown has started.
HRESULT RuntimeAsyncApisProfiler::ExceptionCatcherEnter(FunctionID functionId, ObjectID objectId)
{
_catchers++;
return S_OK;
Summary
Add in-tree Runtime Async profiler coverage for:
ClassLoadcallbacksGetClassIDInfo,GetClassIDInfo2, andGetClassLayoutrejection behaviorValidated on Windows x64 and Linux x64.
Relates to #120799 and #120800.