user2759975
user2759975

Reputation: 71

Cygwin to display cpu usage of a process?

Hopefully, this question can be resolved, as I've been searching all over the web for answers to no avail. Does Cygwin have a command to display cpu % of a Windows process? I know that the command top can display this information, but it only displays Cygwin processes and not Windows. There's another command, ps, but this doesn't display cpu %. Perhaps there's a command that has the best of both top and ps.

Upvotes: 2

Views: 3207

Answers (2)

geezer
geezer

Reputation: 1

This works for me in cygwin, to check if any audio is playing:

t1=`/cygdrive/c/windows/system32/tasklist /fi "ImageName eq audiodg.exe" /v /nh`

(remove the "/nh" to see column headers)

(Actually, this only returned the total cpu usage. But i put it in a loop in a script w/ 'date +%s to get the time, and then calculated the percentage.)

Upvotes: 0

David Ferenczy Rogožan
David Ferenczy Rogožan

Reputation: 25411

Well, you don't need "native" Cygwin application to do that, because Cygwin can execute also native Windows' executables. In fact, Cygwin's "native" executables are Windows' native executables. They just use Cygwin's DLLs to map Linux system calls to Windows' ones.

Just use for example package PsTools from SysInternals (now part of Microsoft). It contains pslist which is able to output running Windows' processes information.

Upvotes: 1

Related Questions