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

Owen Blacker
  • 4,117
  • 2
  • 33
  • 70
Tristan
  • 1,466
  • 1
  • 16
  • 24
  • How did you start your session? This is one approach we have been using - http://svcperf.codeplex.com/wikipage?title=Realtime%2bWCF%2bSession&referringTitle=FAQs – Sajay Jan 24 '13 at 10:48

2 Answers2

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

Brian Rasmussen
  • 114,645
  • 34
  • 221
  • 317
  • 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? – JonDrnek Nov 30 '16 at 17:26
1

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

Lars Truijens
  • 42,837
  • 6
  • 126
  • 143
  • Vance released a custom version of PerfView (http://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. http://blogs.msdn.com/b/vancem/archive/2013/12/09/perfview-version-1-5-has-been-released.aspx – Keith Hill Dec 30 '13 at 22:41