Skip to content

Commit c47dd5d

Browse files
mikelle-rogersdavmason
authored andcommitted
add user_event python script
1 parent 6e6c5f1 commit c47dd5d

File tree

2 files changed

+1134
-4
lines changed

2 files changed

+1134
-4
lines changed

src/coreclr/scripts/genEventing.py

+55-4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,38 @@ def __init__(self, runtime):
8080
"BYTE" : "BYTE",
8181
}
8282

83+
coreCLRUserEventDataTypeMapping={
84+
"win:UInt8" : "TraceLoggingUInt8",
85+
"win:UInt16" : "TraceLoggingUInt16",
86+
"win:Int32" : "TraceLoggingInt32",
87+
"win:UInt32" : "TraceLoggingUInt32",
88+
"win:HexInt32" : "TraceLoggingHexInt32",
89+
"win:UInt64" : "TraceLoggingUInt64",
90+
"win:Int64" : "TraceLoggingInt64",
91+
"win:HexInt64" : "TraceLoggingHexInt64",
92+
"win:Pointer" : "TraceLoggingPointer",
93+
"win:Boolean" : "TraceLoggingBoolean",
94+
"win:UnicodeString" : "TraceLoggingString16",
95+
"win:GUID" : "TraceLoggingGuid",
96+
"win:Binary" : "TraceLoggingBinary",
97+
"win:Double" : "TraceLoggingFloat64",
98+
"win:AnsiString" : "TraceLoggingString",
99+
}
100+
101+
coreCLRUserEventLogLevelMapping={
102+
"win:LogAlways" : "0",
103+
"win:Critical" : "1",
104+
"win:Error" : "2",
105+
"win:Warning" : "3",
106+
"win:Informational" : "4",
107+
"win:Verbose" : "5",
108+
}
109+
110+
coreCLRUserEventArrayTypeMapping={
111+
"win:UInt32" : "TraceLoggingUInt32Array",
112+
"win:Binary" : "TraceLoggingUInt8Array",
113+
"win:UInt64" : "TraceLoggingUInt64Array",
114+
}
83115
monoPalDataTypeMapping={
84116
#constructed types
85117
"win:null" :" ",
@@ -143,6 +175,25 @@ def __init__(self, runtime):
143175
"WCHAR" : "WCHAR",
144176
"BYTE" : "BYTE",
145177
}
178+
def getUserEventDataTypeMapping(runtimeFlavor):
179+
if runtimeFlavor.coreclr:
180+
return coreCLRUserEventDataTypeMapping
181+
# elif runtimeFlavor.mono:
182+
# return monoEventPipeDataTypeMapping
183+
# elif runtimeFlavor.nativeaot:
184+
# return aotEventPipeDataTypeMapping
185+
186+
def getUserEventLogLevelMapping(runtimeFlavor):
187+
if runtimeFlavor.coreclr:
188+
return coreCLRUserEventLogLevelMapping
189+
190+
def getArrayDataTypeMapping(runtimeFlavor):
191+
if runtimeFlavor.coreclr:
192+
return coreCLRUserEventArrayTypeMapping
193+
# elif runtimeFlavor.mono:
194+
# return monoEventPipeDataTypeMapping
195+
# elif runtimeFlavor.nativeaot:
196+
# return aotEventPipeDataTypeMapping
146197

147198
def getEventPipeDataTypeMapping(runtimeFlavor):
148199
if runtimeFlavor.coreclr:
@@ -159,15 +210,15 @@ def getPalDataTypeMapping(runtimeFlavor):
159210
return monoPalDataTypeMapping
160211
elif runtimeFlavor.nativeaot:
161212
return aotPalDataTypeMapping
162-
213+
#maybe need to add getUserEventDataTypeMapping
163214
def includeProvider(providerName, runtimeFlavor):
164215
if (runtimeFlavor.coreclr or runtimeFlavor.nativeaot) and providerName == "Microsoft-DotNETRuntimeMonoProfiler":
165216
return False
166217
elif runtimeFlavor.nativeaot and (providerName == "Microsoft-Windows-DotNETRuntimeRundown" or providerName == "Microsoft-Windows-DotNETRuntimeStress"):
167218
return False
168219
else:
169220
return True
170-
221+
171222
def includeEvent(inclusionList, providerName, eventName):
172223
if len(inclusionList) == 0:
173224
return True
@@ -543,7 +594,7 @@ def generateClrallEvents(eventNodes, allTemplates, target_cpp, runtimeFlavor, wr
543594
if runtimeFlavor.coreclr or write_xplatheader:
544595
fnbody.append(lindent)
545596
fnbody.append("status &= FireEtXplat" + eventName + "(" + ''.join(line) + ");\n")
546-
597+
547598
if runtimeFlavor.nativeaot:
548599
if providerName == "Microsoft-Windows-DotNETRuntime" or providerName == "Microsoft-Windows-DotNETRuntimePrivate":
549600
fnbody.append("#ifndef TARGET_UNIX\n")
@@ -781,7 +832,7 @@ def updateclreventsfile(write_xplatheader, target_cpp, runtimeFlavor, eventpipe_
781832
elif generatedFileType == "source-impl-noop":
782833
Clrallevents.write('#include <CommonTypes.h>\n')
783834
Clrallevents.write('#include <CommonMacros.h>\n\n')
784-
Clrallevents.write('#include <PalRedhawk.h>\n\n')
835+
Clrallevents.write('#include <PalRedhawk.h>\n\n')
785836
Clrallevents.write('#ifndef ERROR_SUCCESS\n')
786837
Clrallevents.write('#define ERROR_SUCCESS 0L\n')
787838
Clrallevents.write('#endif\n\n')

0 commit comments

Comments
 (0)