Re: [CBLX] utilisation CPU et ram

[ Thread Index | Date Index | More lists.tuxfamily.org/carrefourblinux Archives ]


Le 09/11/2020 à 16:04, leglaude a écrit :

Salut,
en faite le retour est beaucoup trop complex.

Dans ce cas, utilise les options de top et grep. Perso, j'ai un alias pps qui revient à faire `top -b -p `pgrep -d "," <process_name>` -n1`.

       -b  :Batch-mode operation
            Starts top in Batch mode, which could be useful for sending
            output from top to other programs or to a file.  In this mode,
            top will not accept input and runs until the iterations limit
            you've set with the `-n' command-line option or until killed.
[...]
       -n  :Number-of-iterations limit as:  -n number
            Specifies the maximum number of iterations, or frames, top
            should produce before ending.
— man top

Exemple de sorties :

# top -b -p `pgrep -d "," pacman` -n1
top - 16:53:37 up 8 min,  0 users,  load average: 0.37, 0.10, 0.03
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s): 13.8 us,  9.2 sy,  0.0 ni, 69.2 id,  0.0 wa,  0.0 hi,  7.7 si,  0.0 st
MiB Mem :  11924.0 total,  10976.3 free,    143.7 used,    804.1 buff/cache
MiB Swap:   3072.0 total,   3072.0 free,      0.0 used.  11518.0 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   54 root      20   0  169664  87704   9776 R 100.0   0.7   0:06.29 pacman
# top -b -p `pgrep -d "," bash` -n1
top - 17:02:30 up 17 min,  0 users,  load average: 0.00, 0.02, 0.00
Tasks:   3 total,   0 running,   3 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  11924.0 total,   9957.5 free,     70.3 used,   1896.2 buff/cache
MiB Swap:   3072.0 total,   3072.0 free,      0.0 used.  11571.4 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
    9 andre     20   0    8652   5364   3784 S   0.0   0.0   0:00.12 bash
   23 andre     20   0    8284   5108   3568 S   0.0   0.0   0:00.05 bash
 2132 root      20   0    8320   4908   3512 S   0.0   0.0   0:00.01 bash




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/