20

Using Sysinternals' Process Explorer, is there a column that can be used to indicate which CPU a process is running on? If no column, is there some other way?

2
48

Requested in 2005:

I am very impressed with the features integrated in Process Explorer but would like to see an option to display each process CPU affinity in the main window as a column toggle.

No response.

Requested in 2007:

Thanks for superb utilities. My request is to add a column option to process explorer to display CPU affinity. That's it.

No response.

Similar discussed in 2013:

It would be really nice if there were a new Process Performance View Column called Core Usage that would show a sum of the usage over the core that the process is running on.

Basic synopsis: It can't be done.

Threads are what are sent to cores for processing, not processes. Most modern processes have multiple threads.

If you manually set the affinity for a process, then all threads for the process should stick to a single processor. Since you manually set it, you should know which CPU it's on. ;)

But if you don't specify, then the thread(s) will be controlled by the OS and underlying processing hardware, and would jump around between processors at a speed that would be unwatchable, and very likely inaccurate by the time it was displayed to you.

Perhaps check out these SU question for more:

Also, from StackOverflow:

Now if you wrote the program, you could use the GetCurrentProcessorNumber, which reports the current processor in use by the thread from which the function was called.

Using this will allow you to make estimations about processor usage by your threads, as you can never be sure where the threads will be one cycle to the next (again, unless you set the affinity on purpose).

More info:

5
  • 3
    Nice answer ... :) – DavidPostill Jan 20 '15 at 14:50
  • @DavidPostill -- Agreed. – rory.ap Jan 20 '15 at 14:53
  • Great answer, as it answers the specific question, gets into the history and whys, and helps to understand the concepts. – Smithers Jan 20 '15 at 18:07
  • 1
    On both Linux and Windows it's possible to set the affinity on a per-thread basis. However, this is rarely ever useful, therefore rarely ever done, therefore displaying a per-thread affinity in a generic monitoring program if it is set is more-or-less useless - the vast majority would just let the kernel schedule as it pleases. – Bob Jan 20 '15 at 22:42
  • 1
    The OS could even switch your thread to another processor just after GetCurrentProcessorNumber is called (but before it starts executing) and again just after it returns, so the result would be neither the processor at the time of the call, nor the processor at the time the call returns! – gnasher729 Jan 21 '15 at 19:07
9

This can be done by capturing a xperf trace and opening it with Windows Performance Analyzer (WPA.exe) from the Windows Performance Toolkit, here you can add a column CPU to see which CPU (Core) the process is running:

enter image description here

2
  • Nice. Does it list the same process under each CPU (if it's using more than one)? Since it's using a captured xperf trace, does that mean it's not live reporting? – Ƭᴇcʜιᴇ007 Jan 21 '15 at 13:39
  • 1
    @Ƭᴇcʜιᴇ007 ETW events can be also consumed at runtime. Writing them into a ETL file is just one way. Yes, it lists processes under both CPU when it uses both. – magicandre1981 Jan 21 '15 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.