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

2

15

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

Premiere answered 19/1, 2013 at 6:4 Comment(1)
How did you start your session? This is one approach we have been using - svcperf.codeplex.com/…Mainsail
B
2

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

Bucket answered 30/12, 2013 at 16:47 Comment(1)
I have created a profile and am recording events using WPR. Things look as I expect when I open the .etl file in PerfView. However, when I open the .etl file in WPA I see a guidinstead of my event source name and numbers instead of my event names. Is that expected?Yalta
F
1

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

Furie answered 30/12, 2013 at 15:45 Comment(1)
Vance released a custom version of PerfView (sdrv.ms/QnHpd4) here that could collect EventSource events and then those could be viewed in WPA. I suspect the recently released 1.5 version of PerfView supports this as well. blogs.msdn.com/b/vancem/archive/2013/12/09/…Carbonari

© 2022 - 2024 — McMap. All rights reserved.