Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit JITStarting, MethodLoad, ModuleLoad and AssemblyLoad EventPipe events on Mono. #53020

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/coreclr/scripts/genEventPipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,11 @@ def generateClrEventPipeWriteEventsImpl(
WriteEventImpl.append("\n return ERROR_SUCCESS;\n}\n\n")

# EventPipeProvider and EventPipeEvent initialization
callbackName = ""
callbackName = 'EventPipeEtwCallback' + providerPrettyName
createProviderFunc = ""
if runtimeFlavor.coreclr:
callbackName = 'EventPipeEtwCallback' + providerPrettyName
createProviderFunc = "EventPipeAdapter::CreateProvider"
elif runtimeFlavor.mono:
callbackName = "NULL"
createProviderFunc = "create_provider"

eventPipeCallbackCastExpr = ""
Expand All @@ -181,6 +179,8 @@ def generateClrEventPipeWriteEventsImpl(
else:
eventPipeCallbackCastExpr = "(EventPipeCallback)"

if runtimeFlavor.mono:
WriteEventImpl.append("void " + callbackName + "(const uint8_t *, unsigned long, uint8_t, uint64_t, uint64_t, EventFilterDescriptor *, void *);\n\n")

if extern: WriteEventImpl.append('extern "C" ')
WriteEventImpl.append(
Expand Down
11 changes: 9 additions & 2 deletions src/coreclr/scripts/genEventing.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,10 @@ def generatePlatformIndependentFiles(sClrEtwAllMan, incDir, etmDummyFile, extern
else:
Clrallevents.write("\n")

if not is_windows and not write_xplatheader:
Clrallevents.write(eventpipe_trace_context_typedef) # define EVENTPIPE_TRACE_CONTEXT
Clrallevents.write("\n")

for providerNode in tree.getElementsByTagName('provider'):
templateNodes = providerNode.getElementsByTagName('template')
allTemplates = parseTemplateNodes(templateNodes)
Expand All @@ -725,9 +729,12 @@ def generatePlatformIndependentFiles(sClrEtwAllMan, incDir, etmDummyFile, extern
providerName = providerNode.getAttribute('name')
providerSymbol = providerNode.getAttribute('symbol')

eventpipeProviderCtxName = providerSymbol + "_EVENTPIPE_Context"
if is_windows:
eventpipeProviderCtxName = providerSymbol + "_EVENTPIPE_Context"
Clrallevents.write(('constexpr ' if target_cpp else 'const ') + 'EVENTPIPE_TRACE_CONTEXT ' + eventpipeProviderCtxName + ' = { W("' + providerName + '"), 0, false, 0 };\n')
Clrallevents.write(('constexpr ' if target_cpp else '') + 'EVENTPIPE_TRACE_CONTEXT ' + eventpipeProviderCtxName + ' = { W("' + providerName + '"), 0, false, 0 };\n')

if not is_windows and not write_xplatheader:
Clrallevents.write('__attribute__((weak)) EVENTPIPE_TRACE_CONTEXT ' + eventpipeProviderCtxName + ' = { W("' + providerName + '"), 0, false, 0 };\n')

if write_xplatheader:
clrproviders = os.path.join(incDir, "clrproviders.h")
Expand Down
Loading