Groups | Blog | Home
all groups > dotnet performance > february 2005 >

dotnet performance : Performance Counters, Instances and Perfmon


Joe Marshall
2/24/2005 9:12:53 AM
"Neil Moss" <neil.moss@sp.am.unitech.net> writes:

[quoted text, click to view]

You need to get them created in the registry. I use this code for
mine:

static void Main () {
// Delete existing counters
if (PerformanceCounterCategory.Exists("Scheme"))
PerformanceCounterCategory.Delete("Scheme");

CounterCreationDataCollection CCDC = new CounterCreationDataCollection();
CCDC.Add (new CounterCreationData ("Apply Setup",
"Calls to applySetup per second",
PerformanceCounterType.RateOfCountsPerSecond32));
CCDC.Add (new CounterCreationData ("Trampoline Bounces",
"Trampoline bounces per second",
PerformanceCounterType.RateOfCountsPerSecond32));
CCDC.Add (new CounterCreationData ("Stack Reloads",
"Stack Reloads per second",
PerformanceCounterType.RateOfCountsPerSecond32));

PerformanceCounterCategory.Create ("Scheme", "Runtime", CCDC);
Console.WriteLine("Created Scheme performance counters.");
}

You need to run this just once.

[quoted text, click to view]

The code above doesn't do instance information. I've been too lazy to
Neil Moss
2/24/2005 12:17:20 PM
Hi group,

I cannot get my performance counter instances to appear in perfmon.

Can someone at MS provide a definitive mechanism for how to do this please?

I am writing a web service which may be installed multiple times on the same
server under different web sites. Thus I want instance information.

I created a new category and counters via the server explorer in the IDE. I
dropped PerformanceCounter components onto the Global.asax surface, set the
category name and counter names, and readonly to false. At
application_startup, I determine the name of the instance I want to record
under, set the InstanceName of all my performance counters, and set RawValue
to 0 to initialize the instance.

Nothing happens as far as perfmon is concerned.

The counters themselves all work fine - the values increment properly, but I
just can't see them in perfmon.

Thanks muchly,
Neil Moss.

Neil Moss
2/24/2005 3:55:59 PM
Hi Joe,

I've had no problem with the counters themselves - I've even got an
installer project working which creates the category and the counters. I
just can't get my instances to show up.

Anyone?

[quoted text, click to view]

Don
3/14/2005 3:11:04 PM
Neil,

Any luck figuring this out? I'm having what seems like a similiar problem. I
can create multiple instance performance counters and write to them, but when
anything tries to read from them they appear as single instance performance
counters?

[quoted text, click to view]
AddThis Social Bookmark Button