Offtopic: Linux ps aux sort cumulative CPU time

From: Ls Cheng <exriscer_at_gmail.com>
Date: Sat, 18 Jan 2020 16:41:16 +0100
Message-ID: <CAJ2-Qb-des6nYzncFsB11GZDgJKCyfe4eLVWbkk=FJazp8WTPw_at_mail.gmail.com>



Hi all

This is a bit offtopic, but a little help would be great.

I am trying to get process with highest cumulative CPU time but ps aux --sort -time| head -n 9 does not work as I expected, I was hoping to see something similar as following (dg4db2AS400C top processes)

ps aux --sort -pcpu | head -n 9

USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
ora11tg   57202 99.4  0.0 148788 20328 ?        Rsl   2019 40364:32
dg4db2AS400XC (LOCAL=NO)
ora11tg  134974 99.4  0.0 148788 20248 ?        Rsl   2019 193192:27
dg4db2AS400XC (LOCAL=NO)
ora11tg  373433 99.4  0.0 148788 20404 ?        Rsl   2019 169730:25
dg4db2AS400XL (LOCAL=NO)
ora11tg   48248 99.3  0.0 148788 20416 ?        Rsl   2019 72485:18
dg4db2AS400XC (LOCAL=NO)
ora11tg  239391 99.3  0.0 148788 20260 ?        Rsl   2019 192392:30
dg4db2AS400XC (LOCAL=NO)
ora11tg  246739 99.3  0.0 148788 20372 ?        Rsl   2019 91992:38
dg4db2AS400XC (LOCAL=NO)
ora11tg  350459 99.3  0.0 148788 20580 ?        Rsl   2019 118145:25
dg4db2AS400XC (LOCAL=NO)
ora11tg  351287 99.3  0.0 148788 20556 ?        Rsl   2019 123978:02
dg4db2AS400XC (LOCAL=NO)

but instead I get this

 ps aux --sort -time| head -n 9

USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root          1  0.9  0.0  19420  2224 ?        Ss    2018 7513:02
/sbin/init
root          2  0.0  0.0      0     0 ?        S     2018   0:25 [kthreadd]
root          3  0.1  0.0      0     0 ?        S     2018 1012:14

[ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S< 2018 0:00
[kworker/0:0H]
root 8 0.4 0.0 0 0 ? S 2018 3275:05
[rcu_sched]
root 9 0.0 0.0 0 0 ? S 2018 0:00 [rcu_bh] root 10 0.1 0.0 0 0 ? S 2018 956:02 [rcuos/0] root 11 0.0 0.0 0 0 ? S 2018 0:00 [rcuob/0]

Anyone know how to sort cumulative CPU time with ps ?

TIA

--
http://www.freelists.org/webpage/oracle-l
Received on Sat Jan 18 2020 - 16:41:16 CET

Original text of this message