K
Kevin Burton
I am stumpped. I am trying to use the PerformanceCounter
class to time a function and I am having no luck. If I
stick to the rather simple NumberOfItems32 then everything
works just fine. But if I deviate from that type I don't
seem to understand.
I am installing the performance counters as:
installer.Counters.Add(new CounterCreationData("Calls",
"Number
of calls.",
PerformanceCounterType.NumberOfItems32));
installer.Counters.Add(new CounterCreationData("Errors",
"Number of
errors in processing.",
PerformanceCounterType.NumberOfItems32));
installer.Counters.Add(new CounterCreationData("Duration",
"Duration
of processing.",
PerformanceCounterType.CounterDelta64));
At runtime I instantiate the Performance counter like:
calls = new PerformanceCounter("PPC
VRU", "Calls", "_Total", false);
errors = new PerformanceCounter("PPC
VRU", "Errors", "_Total", false);
duration = new PerformanceCounter("PPC
VRU", "Duration", "_Total", false);
(yes the category exits)
I have a separte class to do the timeing but when the
timing is done I log it to the performance counter as:
duration.IncrementBy((long)timer.ElapsedMilliseconds());
I have printed out the return from the timer function and
it is not 0 yet PerfMon shows a steady zero. What am I
doing wrong? Like I said the other calls work just fine.
Thank you for your suggestions.
Kevin
class to time a function and I am having no luck. If I
stick to the rather simple NumberOfItems32 then everything
works just fine. But if I deviate from that type I don't
seem to understand.
I am installing the performance counters as:
installer.Counters.Add(new CounterCreationData("Calls",
"Number
of calls.",
PerformanceCounterType.NumberOfItems32));
installer.Counters.Add(new CounterCreationData("Errors",
"Number of
errors in processing.",
PerformanceCounterType.NumberOfItems32));
installer.Counters.Add(new CounterCreationData("Duration",
"Duration
of processing.",
PerformanceCounterType.CounterDelta64));
At runtime I instantiate the Performance counter like:
calls = new PerformanceCounter("PPC
VRU", "Calls", "_Total", false);
errors = new PerformanceCounter("PPC
VRU", "Errors", "_Total", false);
duration = new PerformanceCounter("PPC
VRU", "Duration", "_Total", false);
(yes the category exits)
I have a separte class to do the timeing but when the
timing is done I log it to the performance counter as:
duration.IncrementBy((long)timer.ElapsedMilliseconds());
I have printed out the return from the timer function and
it is not 0 yet PerfMon shows a steady zero. What am I
doing wrong? Like I said the other calls work just fine.
Thank you for your suggestions.
Kevin