1

I'm tracking the CPU usage of a recent build I did to our Windows 2008 SP2 server. Here's the task manager screenie...

alt text

See how it spikes? I wish to find out what are causing em. Before I do anything, I'm guessing I'll need a Memory Dump. Currently the process is around the 450MB mark.

Anyone have any ideas how I can grab a memory dump when it spikes over .. say .. 50%. Spike -> snapshot. not multi-snap shots, just one. I know how to MANUALLY get a dump .. but that's too tough. I need a once of dump after a trigger, say .. cpu > 50%.

Then I have to figure out how to debug it.

Any suggestions?

5 Answers 5

1

Setup a Performance Alert and on the action page, have it run a program or batch script to generate the dump.

alt text

SysInternals VMMap has command line options for scripting, and may give you the information you need.

vmmap.exe -p w3wp.exe C:\memory.txt

The GUI is quite helpful too.

alt text

2

You can grab a memory dump with the Debugging Tools for Windows.

The adplus.vbs script can do this from the command line, so can be added as the task for an alert in a data collection set in Reliability and Performance Monitor.

The challenge is identifying the process over a longer term, w3wp.exe processes typically recycle on a schedule, and thus you would need to re-create the data collection and alerts.

Additional: SysInternals have just released a new command line tool: ProcDump, to create process dumps with inbuilt support for hung (non-responsive) windows and CPU above some threashold. See here.

2
  • Are you saying that the Reliability and Perf Monitor can check for certain things .. eg. cpu goes over a certain threshold. When it does, it can do 'something else'. In this case, it will run the adplus.vbs which is used to get memory dumps (refer to Tess Fernandez's blogs for info on this). Is this what u mean?
    – Pure.Krome
    Jun 18, 2009 at 12:34
  • @Pure: Yes. You can run an arbitrary program. You need to set up an alert, and amongst the logging options (check out the other tabs) are options to run something.
    – Richard
    Jun 19, 2009 at 8:39
2

DebugDiag for IIS can be programmed to take a dump when the application has hung (against certain rules). If there isn't one for CPU usage (I don't remember off the top of my head sorry), the DebugDiag blog has a VB script that will attach to Perfmon and let you trigger a dump when certain criteria are met - in this case, your CPU usage could trigger a full w3wp memory dump.

More than you could ever want to know is contained in the whitepaper "How to Use the Debug Diagnostic Tool v1.1 (DebugDiag) to Debug User Mode Processes".

Update: DebugDiag v2 is now available.

0

If you're trying to work out what is using the CPU then user Performance Monitor. Monitor the "Process" counter %Processor Time for All instances. You can either just watch the graph, or set it to log to a CSV file that you can analyse in Excel.

JR

2
  • Nope - i'm not wanting that at all. i know exactly what process is using my cpu and spiking it it. I need to find the bad code in my website that is causing it to spike. As such, I need a memory dump at the point when it's spiking so i can see what part of the code is cpu intensive.
    – Pure.Krome
    Jun 18, 2009 at 12:31
  • Aha, in that case see Matt Everson's post. You can set Performance Monitor to run a program when the CPU hits a speciifed level. Jun 18, 2009 at 19:00
0

Debugging:

  • Native debugging of dumps can be done in VS2005 and VS2008, just ensure you have symbols set up to use MS' symbol server.

  • Managed (ASP.NET) debugging can be done in VS2010 (in Beta) or WinDbg with the SOS extensions.

Take a look at the following blogs for more details:

Multiple books have been written about this topic, too large for this space to even make a start.

1
  • I'm a massive fan of Tess's blog. I've used it many times. The actual debugging stuff is the second part of the problem, which i'm not tooo worried about. I've done it before, and Tess has a lot of info for idiots like me to get some answers. I'm just not sure how to get the memory dump automatically (not manually) when it hits a min cpu level.
    – Pure.Krome
    Jun 18, 2009 at 12:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .