smwikipedia
smwikipedia

Reputation: 64205

What's the working paradigm of Windows Performance Counter?

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?

Many thanks.

Upvotes: 2

Views: 215

Answers (1)

Mike Dunlavey
Mike Dunlavey

Reputation: 40659

Performance Counters could be an interesting question, but what is your overall goal? Are you interested in finding out how to make programs run faster?

If not, please disregard this answer.

If so, then there is a point of view saying that performance counters exist for the purpose of counting things, things that you would like to measure. Further it says that measuring is fine for seeing if what you fixed made a difference, but it is not much help in finding out exactly where the performance problems (bottlenecks) are.

If there is a bottleneck (and there probably is) that if removed would result in some percent reduction in time (like 30%), then the biggest, most obvious clue as to what it is is this

  • What is the program doing in that 30% of the time?

If you take 10 random-time samples of what it is doing, then on 3 out of 10 (more or less) of those samples, you will "catch it in the act" of doing the bottleneck. Notice one thing - we're asking "what". We are not asking "how much".

The very fact that it takes time is what makes it easy to find. Debugging is hard - you have to trace through the execution and catch it going wrong. Finding bottlenecks is easy - they expose themselves to you.

You don't need to measure in order to find. Once you find, you can measure. Here's more on that subject.

Upvotes: 1

Related Questions