Skip to content

Add Runtime Async profiler API coverage - #131988

Open
tommcdon wants to merge 1 commit into
dotnet:mainfrom
tommcdon:dev/tommcdon/runtime-async-profiler-coverage
Open

Add Runtime Async profiler API coverage#131988
tommcdon wants to merge 1 commit into
dotnet:mainfrom
tommcdon:dev/tommcdon/runtime-async-profiler-coverage

Conversation

@tommcdon

@tommcdon tommcdon commented Aug 7, 2026

Copy link
Copy Markdown
Member

Summary

Add in-tree Runtime Async profiler coverage for:

  • array and metadata-less continuation ClassLoad callbacks
  • GetClassIDInfo, GetClassIDInfo2, and GetClassLayout rejection behavior
  • continuation-to-captured-array GC reference traversal
  • JIT callbacks, FunctionID/native-IP round-tripping, and IL-to-native mappings
  • exception search, unwind, and catcher callbacks

Validated on Windows x64 and Linux x64.

Relates to #120799 and #120800.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 7, 2026 04:21
@azure-pipelines

Copy link
Copy Markdown
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 runtimeasyncapis and runtimeasynctypes that run under ProfilerTestRunner with DOTNET_RuntimeAsync=1.
  • Adds native profilers RuntimeAsyncApisProfiler and RuntimeAsyncTypesProfiler and wires them into the native test profiler build and ClassFactory.
  • 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 under src/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 into pCorProfilerInfo after 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;

Comment thread src/tests/profiler/runtimeasyncapis/runtimeasyncapis.csproj
Comment thread src/tests/profiler/runtimeasynctypes/runtimeasynctypes.csproj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants