1

In linux we have ps and top command that can give very good detail about processes CPU utilization along with on which cores it is running.

Do we have something like that in windows which can give Processes and its threads along with CPU usage and on which Core it is running in the command line?

I have looked in tasklist, wmic but none of it gives on which core the process is running. There is another tool called Xperf but it seems some complicated as it is used with another tool to give GUI where we can look for the cores.

Is there any easy way?

Clijsters
  • 4,031
  • 1
  • 27
  • 37
iCurious
  • 8,161
  • 7
  • 28
  • 46
  • start notepad or notepad++ and run `get-process notepad* | Select *` and investigate... – Kory Gill Sep 11 '18 at 04:50
  • @KoryGill I did checked that as well but still it doesn't shows which CPU cores the process or its threads are using. – iCurious Sep 11 '18 at 05:15

1 Answers1

0

Well, of course each OS is different, so expectations need to be adjusted.

No specific single standalone cmdlets for that sort of thing. So, no, you have to write what you'd want. Nothing in the process class on Windows has a property for CPU, but not Cores.

Even for what you are after, it's in different objects.

Get-WmiObject -Class Win32_Process | Select-Object -Property * -First 1
Get-WmiObject -Class Win32_Processor | Select-Object -Property *
Get-WmiObject -Class Win32_ComputerSystem | Select-Object -Property *

All-in-all, if you are trying to replicate the Linux like ps and top. You are going to have to look at lower level API's on MSDN, Pinvoke and the like.

Since this not the first time the question has be brought up, and there are several schools of though about it. See the information as outlined here:

Get-ProcessThreadsInfo

PowerShell Problem Solver: Getting Process Details

Determine which CPU a process is running on

Identify processor (core) is used by specific thread

postanote
  • 15,138
  • 2
  • 14
  • 25