0

I am trying to create one performance counter through "logman.exe" and try to read through Microsoft Tx (LINQ to Logs and Traces), but I am getting below error,

System.ComponentModel.Win32Exception: 'The instance name passed was not recognized as valid by a WMI data provider'

Process logman = Process.Start(
            "logman.exe",
            "create counter Test_Perf_log -c \"Processor(_Total)\"% Processor Time");
        logman.WaitForExit();

        IObservable<EtwNativeEvent> session = EtwObservable.FromSession("Test_Perf_log");
        using (session.Subscribe(e => Console.WriteLine("{0} {1}", e.TimeStamp, e.UserData)))
        {
            Console.ReadLine();
        }

I am suspecting that counter "Test_Perf_log" creation through "logman.exe" is not correct, please help on this.

Thanks,

user584018
  • 10,186
  • 15
  • 74
  • 160

1 Answers1

0

Your text is not correct: this is the output-

create counter Test_Perf_log -c "Processor(_Total)"% Processor Time

The format shown by logman /? is this:

create counter perf_log -c "\Processor(_Total)\% Processor Time"

To achieve that, you would use this:

"create counter perf_log -c \"\\Processor(_Total)\\% Processor Time\""
stuartd
  • 70,509
  • 14
  • 132
  • 163