Analyzing Performance with Sampling

Previous programs in this chapter provided interesting statistics to look at and even provided a general idea of what was happening with system performance. This is nice, but sometimes you really need to zero in on what's going on with a program and get a better picture of a more sophisticated scenario. Performance counter sampling does just that.

Sampling is the capability to perform specialized calculations between successive performance counter results. This is especially relevant in tracking averages and discovering trends. Listings 32.5 and 32.6 show how to create a custom performance counter that performs sampling.

Listing 32.5. Sampling Client: SampleClient.cs
 using System; using System.Drawing; using ...

Get C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.