I want to create a table of process names and total processor time, sorted by the total processor time. The following works as expected:
ps | sort -p cpu | select processname,cpu
But if I reverse the sort direction as follows, the processor time columns disappear:
ps | sort -descending -p cpu | select processname,cpu
Why is this?
It seems that the CPU property is sometimes Double, and sometimes null. When I ran the first command, the first element had a zero CPU, and the column was displayed: for the second command, the first element has a two-digit CPU, but the column is not displayed.
When a column is not displayed, it still exists! Using Format-List, display it, for example:
ps | sort -descending -p cpu | select processname,cpu | fl
What's happening?
source share