Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EventSource vs EventProvider

Tags:

What are the main differences between the EventSource and EventProvider classes?

I understand both classes to be an event provider for ETW. If there aren't key differences in the two then what are the pros and cons.

I use the EventSource class simply because I found more examples/documentation online, and it seemed more straightforward to implement Channel support (writing to the default channels in the Event Viewer - admin, operational, analytic, and debug) because the EventRegister class automatically creates the manifest (described here).

like image 710
FalacyNine Avatar asked Feb 17 '17 12:02

FalacyNine


1 Answers

In .NET 3.5 the EventProvider class was the only option for tracing using ETW. As the documentation states, you must create an Instrumentation Manifest file for your custom events, which describes the data types inside your messages. This is not such easy task, and it requires using separate tools, such as the Manifest Generator (ecmangen.exe). For more information, please see this post.

The EventSource class was added in .NET 4.5 and it introduced a simpler approach to writing your own events using ETW. Instead of creating these manifest files, they are automatically created for you, sparing the overhead.

I don't see any reason to use EventProvider given the above. As you mentioned, EventSource is more documented and much easier to use.

like image 107
Tomer Avatar answered Sep 21 '22 11:09

Tomer