System.Diagnostics.PerformanceCounter

G

Guest

Hi...

I've been reading some of the msdn pages on old-style custom performance
counters and the .Net framework System.Diagnostics.PerformanceCounter, and
it's a pretty stark contrast.

All of the older, unmanaged code documentation I've found says "here are
some registry entries, here are a few interfaces you have to implement,
everything else is up to you." Interprocess communication, data allocation,
management, etc are "left to an exercise to the user." Basically, it seems a
very user-unfriendly class of problem.

Contrasted to the System.Diagnostics.PerformanceCounter documentation I've
seen, where absolutely everything seems to be covered, I wonder was there
anything ever inbetween? Were there ever ATL or MFC classes to handle things
like process interop?

I come to the question because we're trying to upgrade an old C++ isapi
filter from IIS 5 use to IIS 6 compatibility. Our ISAPI filter kept stats
and the old iis process model made that easy, since all requests went through
the filter from the central inetinfo process. Now that IIS 6 puts the
filters on each worker process, we need some way to aggregate the statistics.

Since it's an old, unmanaged c++ filter, I was looking at how to implement
performance counters the old way and potentially centralize the stats that
way, but the documentation basically said "abandon all hope, ye who enter
here".

Looking at the .Net framework version of same, however, it seems almost too
good to be true. Simple class interface that handles all process interop.
Is that built on top of some ATL classes I didn't find? Is it really going
to work interprocess?

The other thing that wasn't clear from the Framework PerformanceCounter
documentation was about the lifetime of any given counter - if I do a new
PerformanceCounter () in all 4 IIS worker processes, for example, when does
that performance counter disappear from Perfmon? When the last instance of
the class goes out of scope for the last IIS worker process?

Thanks
_mark
 
P

Peter Huang [MSFT]

Hi,

Currently I am researching the issue and we will reply here with more
information as soon as possible.
If you have any more concerns on it, please feel free to post here.

Thanks for your understanding!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Thanks, Peter... That's the best news I could expect. Also, if you think I
should be posting these questions to another group or set of groups that
would be a reasonable answer.

-Mark
 
P

Peter Huang [MSFT]

Hi

Based on my knowledge, the PerformanceCounter in .NET is also an
implementment with unmanaged code, but it is not public.

Also once we have registered a PerformanceCounter and it will keep working.
e.g. there is an object will collection data in the counter, if there is no
data, it will have no graph in the Perfmon.

PerformanceCounter Sample: Performance Monitoring in an ATL Server
Application
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample/ht
ml/vcsamPerformanceCounterSample.asp

BTW: you may try post in the newsgroup below.
microsoft.public.dotnet.framework.performance
microsoft.public.dotnet.framework.clr

For unmanaged question, you may post in the newsgroup below.
microsoft.public.win32.programmer.kernel

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top