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

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top