Skip to content

Commit

Permalink
Fix missing GC events on non-Windows for nativeaot (#88282)
Browse files Browse the repository at this point in the history
  • Loading branch information
elinor-fung authored Jul 10, 2023
1 parent caff01c commit acafb20
Show file tree
Hide file tree
Showing 16 changed files with 3,261 additions and 3,317 deletions.
14 changes: 12 additions & 2 deletions src/coreclr/nativeaot/Runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ if (WIN32)
windows/PalRedhawkCommon.cpp
windows/PalRedhawkMinWin.cpp
${GC_DIR}/windows/gcenv.windows.cpp
eventtrace.cpp
rheventtrace.cpp
)

list(APPEND FULL_RUNTIME_SOURCES windows/CoffNativeCodeManager.cpp)
Expand Down Expand Up @@ -222,6 +220,18 @@ endif()

if(FEATURE_EVENT_TRACE)
add_definitions(-DFEATURE_EVENT_TRACE)
list(APPEND COMMON_RUNTIME_SOURCES
eventtrace.cpp
)
# These are carry-overs from .NET Native and only included on Windows currently
# bulktype : directly emits via ETW with EventWrite
# gcheap : GCHeapDump, GCHeapSurvivalAndMovement - not prioritizing for nativeaot yet
if (WIN32)
list(APPEND COMMON_RUNTIME_SOURCES
eventtrace_bulktype.cpp
eventtrace_gcheap.cpp
)
endif()
endif()

add_definitions(-DFEATURE_BASICFREEZE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,3 +632,8 @@ ULONG EventPipeWriteEventGCFitBucketInfo(
{
return 0;
}

bool DotNETRuntimeProvider_IsEnabled(unsigned char level, unsigned long long keyword)
{
return false;
}
15 changes: 15 additions & 0 deletions src/coreclr/nativeaot/Runtime/eventpipe/dotnetruntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3147,3 +3147,18 @@ void InitDotNETRuntime(void)
EventPipeEventGCLOHCompact = EventPipeAdapter::AddEvent(EventPipeProviderDotNETRuntime,208,1,0,EP_EVENT_LEVEL_INFORMATIONAL,true);
EventPipeEventGCFitBucketInfo = EventPipeAdapter::AddEvent(EventPipeProviderDotNETRuntime,209,1,0,EP_EVENT_LEVEL_VERBOSE,true);
}

bool DotNETRuntimeProvider_IsEnabled(unsigned char level, unsigned long long keyword)
{
if (!EventPipeAdapter::Enabled())
return false;

EVENTPIPE_TRACE_CONTEXT& context = MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_DOTNET_Context.EventPipeProvider;
if (!context.IsEnabled)
return false;

if (level > context.Level)
return false;

return (keyword == (ULONGLONG)0) || (keyword & context.EnabledKeywordsBitmask) != 0;
}
Loading

0 comments on commit acafb20

Please sign in to comment.