I have just finished reading this article about how to create a performance counter and update the counter's value. But I am a little confused about the working paradigm of the Windows Performance Counter. Suppose there're 2 programs A and B, and A want to know B's performance through some performance counters. Which of the following scenarios is correct?
B create/register some performance counters into the Windows and B is responsible for updating the counters' value. A could be the system perfmon.exe. A is not actively probing B's execution status. A just check the registerd counters and get the value which is supplied and updated by B. Even there is no A, the B still always updates its registered performance counters. But isn't this some kind of burden to B's performance?
A actively probes B's execution status and figure out the performance counter value. In this paradigm, B doesn't have any extra burten.
In short, who is responsible for create and update the Performance Counters? The object program whose performance is being measured? Or the subject program who is measuring the object program's performance? For program A, is it a probing scenario? or just a reading scenario?
Many thanks.