Say I have the following code:
PerformanceCounter c = new PerformanceCounter("Processor", "% Processor Time", "_Total", true);
and then I keep a reference to c
, does c
consume CPU time? Or does it only consume CPU when calling:
c.NextValue();
?
I.E. Does the PerformanceCounter do work all the time, "counting" resource use, or is it just a tool with which we can access that information, which is being recorded by the computer independently of the PerformanceCounter?
My question is not only about this specific counter. So if the answer depends on the type of counter, so be it. Though some explanation as to how I would go about telling the CPU-users from the non CPU-users would be welcome.
EDIT
Since it was suggested that this is a duplicate of another question, please read a) The other question. b) The answers. Since the question is different and the answers only tangentially touch upon the subject (and don't even agree with one another) I don't think it's a duplicate.