onnxruntime/ort.wprp
ivberg 74028e4bdc
Fully dynamic ETW controlled logging for ORT and QNN logs (#20537)
### Description
Windows - Fully dynamic ETW controlled logging for ORT and QNN logs

The logging support is documented here 
-
https://onnxruntime.ai/docs/performance/tune-performance/logging_tracing.html#tracing---windows
-
https://onnxruntime.ai/docs/performance/tune-performance/profiling-tools.html#tracelogging-etw-windows-profiling

Also add support for logging ORT SessionCreation on ETW CaptureState

### Motivation and Context
The previous ETW support only worked if you enabled ETW before the
session started. There can commonly be long-lived AI inference processes
that need to be traced & debugged. This enables logging fully on the
fly.

Without this support a dev would have to end up killing a process or
stopping a service in order to get tracing. We had to do this for a
recent issue with QNN, and it was a bit painful to get the logs and it
ruined the repro.

### Testing
I tested with the following cases
- Leaving default ORT run
- Enabling ETW prior to start and leaving running for entire session +
inferences, then stopping
- Starting ORT session + inf, then enabling and stopping ETW
  - Start ORT session /w long running Inferences 
- wpr -start
[ort.wprp](e6228575e4/ort.wprp (L4))
-start
[etw_provider.wprp](e6228575e4/onnxruntime/test/platform/windows/logging/etw_provider.wprp)
  - Wait a few seconds
  - wpr -stop ort.etl
  - Inferences are still running
- Verify ONNXRuntimeLogEvent provider events are present and new
SessionCreation_CaptureState event under Microsoft.ML.ONNXRuntime
provider

Related:
#18882
#19428
2024-06-06 21:11:14 -07:00

54 lines
2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- TODO:
1. Find and replace "OrtTraceLoggingProvider" with your component name.
2. See TODO below to update GUID for your event provider
-->
<WindowsPerformanceRecorder Version="1.0" Author="Microsoft Corporation"
Copyright="Microsoft Corporation" Company="Microsoft Corporation">
<Profiles>
<EventCollector Id="EventCollector_OrtTraceLoggingProvider"
Name="OrtTraceLoggingProviderCollector">
<BufferSize Value="1024" />
<Buffers Value="10" PercentageOfTotalMemory="true"/>
</EventCollector>
<EventProvider Id="EventProvider_OrtTraceLoggingProvider" Name="3a26b1ff-7484-7484-7484-15261f42614d" Level="5" >
<CaptureStateOnSave>
<Keyword Value="0x1"/> <!-- Session rundown -->
</CaptureStateOnSave>
</EventProvider>
<Profile Id="OrtTraceLoggingProvider.Verbose.File"
Name="OrtTraceLoggingProvider" Description="OrtTraceLoggingProvider"
LoggingMode="File" DetailLevel="Verbose">
<Collectors>
<EventCollectorId Value="EventCollector_OrtTraceLoggingProvider">
<EventProviders>
<EventProviderId Value="EventProvider_OrtTraceLoggingProvider" />
</EventProviders>
</EventCollectorId>
</Collectors>
</Profile>
<Profile Id="OrtTraceLoggingProvider.Light.File"
Name="OrtTraceLoggingProvider"
Description="OrtTraceLoggingProvider"
Base="OrtTraceLoggingProvider.Verbose.File"
LoggingMode="File"
DetailLevel="Light" />
<Profile Id="OrtTraceLoggingProvider.Verbose.Memory"
Name="OrtTraceLoggingProvider"
Description="OrtTraceLoggingProvider"
Base="OrtTraceLoggingProvider.Verbose.File"
LoggingMode="Memory"
DetailLevel="Verbose" />
<Profile Id="OrtTraceLoggingProvider.Light.Memory"
Name="OrtTraceLoggingProvider"
Description="OrtTraceLoggingProvider"
Base="OrtTraceLoggingProvider.Verbose.File"
LoggingMode="Memory"
DetailLevel="Light" />
</Profiles>
</WindowsPerformanceRecorder>