The specification for the System.Diagnostics.Tracing.EventSource class.

In my last blog entry I gave a 'Hello World' Style example of using the new .NET V4.5 class System.Diagnostics.Tracing.EventSource. 

This class lets you log ETW events from managed code easily.  

This is a quick follow on to give you access to more details, quickly.   Attached to this poisting is the original specification for the EventSource type (Called 'StronglyTypedEvents.docx becasue ETW events have a rigid schema associated with them (unlike TraceSource)).  

Roughly speaking the spec can serve as is a reference guide, and it lists many of the details of the design of EventSource that are not obvious from looking at the APIs themselves.   However this document also tries to

It is my intent that I will give a more tutorial introduction to these over the comming weeks, however I am posting this spec, for those who simply can't wait (or if I am delayed (:-).

 

StronglyTypedEvents.docx

Comments

  • Anonymous
    July 10, 2012
    Hello, Vance - I'm glad to see this moving into .NET proper, and it looks like you've done an excellent job designing the API! Just one question: is there any support for e2e / ActivityId / Transfer?       -Steve

  • Anonymous
    July 11, 2012
    OK, one more question: Do you know if/when xperf/xperfview will be updated to support the Guid-from-name and event-schema-in-event-stream conventions?

  • Anonymous
    July 14, 2012
    You can use the EventProvider APIs that will attach ActivitityIds to ETW events (this is really independent of EventSource.  However doing a good job of end-to-end activities requires more support in the reading tools.   We are thinking about this, and we may add some features to EventSource to support it, but EventSource does not do this at the present time. Whether XPERF supports the EventSource conentions is not clear at this time.  

  • Anonymous
    December 08, 2013
    Hello, Vance! I've tried to implement a WriteEvent overload with WriteEventCore and found couple of mistakes in the example:

  1. EventData* dataDesc = stackalloc EventProvider.EventData[4]; EventData is defined in the EventSource class, not in EventProvider
  2. WriteEventCore(eventId, 4, (IntPtr)dataDesc); casting to IntPtr is incorrect Btw, exactly the same example is on MSDN
  • Anonymous
    August 19, 2015
    Very informative article! All I need to know about EventSource, ETW, EventListeners is there :)