How can I find out what's the bottleneck slowing down a particular process / the entire system?

Given a specific running process, is there a way to find out what hardware element is currently the bottleneck for its operation? In other words, is its current computation CPU-bound, GPU-bound, memory-bound, IO-bound, etc?

Answers that work for Windows XP are preferable, but all answers are welcome.

EDIT: I'm thinking about processes that take the absolutely majority of system resources to themselves; so solutions that can help me find the current battleneck for the entire system (e.g. what element is working hard the most while the others are resting) is fine as well.

EDIT 2: someone has asked me this question and my answer was

Open your task manager and choose to view page faults for the application - a very high count hints that you do not have enough physical memory. Check out the CPU utilization - if it's constantly at 100% it's a sign it may not be fast enough for this real-time application.

That's what I would have done but it feels a bit amateur-ish, so I'm looking for more precise, complete ways to identify the offender.


Solution 1:

You can use the Microsoft XPERF tools to walk the stack and find bottle necks. You can only view the results on Vista/7 (or server 2008) but you can run the profile tool on XP. Pigs Can Fly has some really good articles on stackwalking with XPERF.

We used it to find bottlenecks in our boot speed, and finally had proof to show the company to remove some tools that were taking too much Disk IO at boot.