Skip to content

Instantly share code, notes, and snippets.

@amithegde
Created January 28, 2016 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amithegde/a0e35951e2e18d1d9b10 to your computer and use it in GitHub Desktop.
Save amithegde/a0e35951e2e18d1d9b10 to your computer and use it in GitHub Desktop.
capturing EWT events
void Main()
{
//include nuget package: http://www.nuget.org/packages/Microsoft.Diagnostics.Tracing.TraceEvent/
using (var session = new TraceEventSession("My session", null))
using (var source = new ETWTraceEventSource("My session", TraceEventSourceType.Session))
{
var parser = new DynamicTraceEventParser(source);
parser.All += delegate (TraceEvent data)
{
Console.WriteLine("Got Event: " + data.ToString());
};
session.EnableProvider("provider guid");
source.Process();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment