I would like to fire ETW events using EventSource
and view them with Windows Performance Analyzer.
I have a basic EventSource
:
[EventSource(Name = "BasicEventSource")]
public class ETWLogger : EventSource
{
#if DEBUG
private const bool ThrowOnError = true;
#else
private const bool ThrowOnError = false;
#endif
private ETWLogger(bool throwOnError) : base(throwOnError) { }
private static ETWLogger _log;
public static ETWLogger Log
{ get { return _log ?? (_log = new ETWLogger(ThrowOnError)); } }
private static class Keywords
{
public const EventKeywords Perf = (EventKeywords) 1;
}
[Event(1, Keywords = Keywords.Perf, Level = EventLevel.Informational)]
public void Startup() { WriteEvent(1, "StartUp"); }
}
When I record with Windows Performance Recorder (WPR), I don't see my provider or events in the Generic Events graph of Windows Performance Analyzer (WPA).
Thanks for your time :)
The framework monitors and reports on Windows Telemetry ETW (Event Tracing for Windows) activities – ETW activities for providing data to Windows Telemetry. It consists of two components: the Windbg Framework: a set of scripts for monitoring Windows Telemetry ETW activities.
Event Tracing for Windows (ETW) is an efficient kernel-level tracing facility that lets you log kernel or application-defined events to a log file. You can consume the events in real time or from a log file and use them to debug an application or to determine where performance issues are occurring in the application.
Event Tracing for Windows (ETW) provides a mechanism for instrumentation of user-mode applications and kernel-mode drivers. The Log Analytics agent is used to collect Windows events written to the Administrative and Operational ETW channels.
WPR doesn't know anything about your custom EventSource
, so you have to create a recording profile so you can enable it. WPT ships with a couple of sample profiles that should help you get started.
The 8.1 version of WPR supports the same naming convention as PerfView, which means that you can use *YourEventSource
instead of the GUID in the profile.
In my experience some of the EventSource
features are not well supported in the 8.1 version of WPA. E.g. if you use tasks they won't show up correctly. However, the basic usage of EventSource
works well with the 8.1 version of WPA/WPR when you create a recording profile for your EventSource
.
Another option is to collect the trace using PerfView and analyze it with WPA (if you prefer that over PerfView).
WPR and WPA did not support EventSource, but do with the new 8.1 ADK. See here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With