Receiving Multiplied Rundown events instead of once for the same ETW session

45 Views Asked by At

I have a simple usage of ETW.

I've subscribed to receive events from USB4 provider.

I have 2 sessions:

  • A real time session which I use to print to the console log

  • Second for log the events to a log file for a further investigation.

      var s = new TraceEventSession("mySession", TraceEventSessionOptions.NoPerProcessorBuffering);
      var s2 = new TraceEventSession($"mySession-log", @"C:\mySession.etl", TraceEventSessionOptions.NoPerProcessorBuffering);
    
      var PROVIDER_GUID = new Guid("AE795D36-2B11-5EFB-C7E0-5D552BC55D6C");
    
      var dynamicTraceEventParser = s.Source.Dynamic;
      dynamicTraceEventParser.All += delegate (TraceEvent data)
      {
          Console.WriteLine($"Received DRD event: {data.EventName}");
      };
    
      s.EnableProvider(PROVIDER_GUID);
      s2.EnableProvider(PROVIDER_GUID);
    
    
      s.Source.Process(); 
    

Excepted Result:

Receive the event RundownStart/Start only once in the log.

Actual result:

Receive the event RundownStart/Start twice in the log.

I've realized that creating only one session, I receive the event only once but I'm not sure how creating two different un depend sessions can cause this.

Are the sessions depend of each other?

Thank you :)

0

There are 0 best solutions below