Tuesday, February 17, 2009

Performance Monitor / Counters not working in XP

Strangely enough, the XP machine I use in the office has never had the performance counters working.

If you tried running SysInternal's pslist (I use it mostly so I could do pskill for the issue I blogged about here), you'll get a message saying, "Processor performance object not found on Run Exctrlst from the Windows Resource Kit to repair the performance counters."

Or, if you try running the Performance MMC snap-in (In XP it's under Control Panel --> Administrative Tools --> Performance), you'll get no response for a minute or two, and when the window appears, the red line in the graph will not move (and you won't be able to add any graphs for monitoring either).

Or, if you try to use performance counters in .NET (e.g. for CPU Usage monitoring), you'll get an exception complaining performance counters are not available.


What's the problem? To be honest, I don't know and I don't care enough to find out, but I do care enough to make it work.


Here's how:
  • Install Windows Support Tools which could be found on Microsoft's website (here's the XP SP2 version which will also run in SP3 - http://www.microsoft.com/downloads/details.aspx?FamilyID=49ae8576-9bb9-4126-9761-ba8011fabf38&displaylang=en)
  • Once you've installed it, run exctrlst.exe
  • Make sure that PerfProc and PerfOS have their Performance Counters enabled (select the entry and verify that the "Performance Counters Enabled" option is checked)
  • Once you've done that, close the window and run PsList again to see if it works
  • If not, continue reading. You'll need a copy of Windows installation CD for the following steps

PsList is still not working:

What we'll be doing is manually replace some of the files with the original ones (I'm guessing at some point, Microsoft released a hotfix which broke the files).
  • Go to the I386 folder on your Windows CD
  • Make a backup of C:\Windows\System32\perfc009.dat and C:\Windows\System32\perfh009.dat (we'll be overwriting them)
  • Expand perfc009.da_ to C:\Windows\System32\perfc009.dat (expand perfc009.da_ C:\Windows\System32\perfc009.dat)
  • Expand perfh009.da_ to C:\Windows\System32\perfh009.dat (expand perfh009.da_ C:\Windows\System32\perfh009.dat)

Try running PsList again - it should work now.


If all of the above failed, there's one other resource you could read up - How to manually rebuild Performance Counter Library values.

6 comments:

elominac said...

Thanks! This did the trick!

Anonymous said...

Thank You! That solved the problem.

.: sErgIO! :. ® said...

Thanks!

Anonymous said...

Setting Perfproc and perfos as "Enabled" when the Library Radio button was the solution and the only concise one despite painstaking research of the sysinternals forums and failed advice at OTHER SITES but YOURS WAS THE SOLUTION, THANKS, THANKS, THANX!

Anonymous said...

In windows XP just copied :

"copy perfi009.dat perfh009.dat"
and
"copy perfi009.dat perfh009.dat"

within system32 folder.
This has happened propably after .net and windoes sp3 updates.
Propably the filenames have chenged in the new service packs.

Did the trick for me, Hopefully it will work for you too.
;-)
Cheers Billy

Nico said...

the only thing that worked for me was the command: lodctr /R

that fixed it after I tried the other solutions. FYI