Good morning,
Here is the objective: monitoring the CPU usage of a given thread in my
own C# application.
Here is what I do:
- on a Form I put a PerformanceCounter
- I set e CategoryName = Thread
- I set the CounterName = % Processor time
- I set the Machine = . (local machine)
Then I am trying to set the InstanceName and it is where it all goes
wrong...
The InstanceName should be something like: MyAppName/5
And the problem is I do not know how to get the right number (5 or 6 or
7 ???).
I have tried with :
- AppDomain.GetCurrentThreadId()
- System.Threading.Thread.CurrentThread.GetHashCode
But neither of them is the number I need for the PerformanceCounter.
Can you help please?
Thanks.
--
Michael
----
http://michael.moreno.free.fr/
http://port.cogolin.free.fr/