Cinchoo – Using Performance Counters, Part 3

In this section, I’ll talk about installing and uninstalling Performance Counters using Cinchoo framework. This is the explicit way of installing and uninstalling them.

1. Add reference to Cinchoo.Core.dll assembly

2. Namespace Cinchoo.Core.Instrumentation.Performance

For a sample performance counter class defined as below

[ChoPerformanceCounterCategory("Random Single Instance Test", PerformanceCounterCategoryType.SingleInstance)]
public sealed class SingleInstancePerfCounters : ChoPerformanceCounterCategory
{
    #region Performance Counters

    [ChoPerformanceCounter("Random Rate", "", PerformanceCounterType.RateOfCountsPerSecond32)]
    public readonly ChoPerformanceCounter PCRandomRate = null;

    [ChoPerformanceCounter("Random Average", "", PerformanceCounterType.AverageCount64)]
    public readonly ChoPerformanceCounter PCRandomAverage = null;

    #endregion
}

Installing Performance Counters

This is how to install the performance counter using ChoPerformanceCounterInstaller helper class

ChoPerformanceCounterInstaller.Install(typeof(SingleInstancePerfCounters))

Uninstalling Performance Counters

Here is how to uninstall the performance counter using ChoPerformanceCounterInstaller helper class

ChoPerformanceCounterInstaller.Uninstall(typeof(SingleInstancePerfCounters))
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s