For Programmers: Free Programming Magazines  


Home > Archive > VC STL > January 2006 > PerfMon Via Registry









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PerfMon Via Registry
Shawn Pecze

2006-01-09, 11:10 pm

I have a Java application in which I would like to display the PerfMon
objects, instances and counters on a particular system. I have written some
JNI code to do this following the example outlined here
http://msdn.microsoft.com/library/d...
ames.asp


This works as expected on some windows systems, but it fails on others.
When it fails, my JVM crashes and the java core dump indicates an access
violation.

I've narrowed it down to the following line:
PerfCntr = NextCounter( PerfCntr );
in the else clause for when there are no instances for a particular object.

The one thing that is common on all of the systems where the code fails is
that there is at least one PerfMon object for which there are no instances or
counters defined. This is not the case on systems where the code works.

I've verified this by displaying the number of counters the object thinks it
has. On one particular system, although the object has no counters,
PerfObj->NumCounters returns 13.

Thus, I think that I'm incrementing the pointer right out of the buffer I've
allocated for the Perfmon data.

Is this a Windows bug? Or is there an additional check that isn't listed in
the example that I need to perform to make sure there are actually counters
defined for the object?

Thanks,
Shawn
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com