Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you view ETW events created by EventSource using Windows Performance Analyzer?

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 :)

like image 662
Tristan Avatar asked Jan 19 '13 06:01

Tristan


People also ask

What is ETW monitor?

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.

What is ETW logging?

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.

What is ETW channel?

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.


2 Answers

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).

like image 171
Brian Rasmussen Avatar answered Sep 25 '22 20:09

Brian Rasmussen


WPR and WPA did not support EventSource, but do with the new 8.1 ADK. See here.

like image 25
Lars Truijens Avatar answered Sep 22 '22 20:09

Lars Truijens