The ETW Sink (ONNXRuntimeTraceLoggingProvider) allows ONNX semi-structured printf style logs to be output via ETW.
ETW makes it easy and useful to only enable and listen for events with great performance, and when you need them instead of only at compile time.
Therefore ONNX will preserve any existing loggers and log severity provided at compile time.
However, when the provider is enabled a new ETW logger sink will also be added and the severity separately controlled via ETW dynamically.
Notes:
- The ETW provider must be enabled prior to session creation, as that as when internal logging setup is complete
- Other structured ETW logs are output via the other Microsoft.ML.ONNXRuntime ETW provider. Both used together are recommended
From an elevated prompt, assuming wpr.exe and wpa.exe are in the path (if not, most likely they can be found under C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit) do the following:
Start the ETW tracing<path to repo>\onnxruntime\test\platform\windows\logging> wpr -start .\etw_provider.wprp
Note: If you add '-start GeneralProfile' a huge amount of data will be captured. Not necessary for checking log messages are produced. It will also result in a huge number of ngen.exe calls when you attempt to stop logging the first type.
Run the ETW sink unit tests
<path to repo>\build\Windows\Debug\Debug\onnxruntime_test_framework.exeStop the ETW tracing<path to repo>\onnxruntime\test\platform\windows\logging> wpr -stop TraceCaptureFile.etl EtwSinkTest
Open TraceCaptureFile.etl file in Windows Performance Analyzer.
Expand the "System Activity" dropdown in the left pane, and double-click "Generic Events".
That should open events in an Analysis window in the right pane. You should see an event
with provider of ONNXRuntimeTraceLoggingProvider, and the log message output.