How to monitor CPU/memory usage of a single process?

I would like to monitor one process’s memory / cpu usage in real time. Similar to top but targeted at only one process, preferably with a history graph of some sort.

Asked By: Josh K

||

On Linux, top actually supports focusing on a single process, although it naturally doesn’t have a history graph:

top -p PID

This is also available on Mac OS X with a different syntax:

top -pid PID
Answered By: Michael Mrozek

I normally use following two :

  1. HP caliper : its very good tool for monitoring processes it you can check call graph and other low level information also. But please note its free only for personal use.

  2. daemontools : a collection of tools for managing UNIX services

Answered By: Hemant

htop is a great replacement to top. It has… Colors! Simple keyboard shortcuts! Scroll the list using the arrow keys! Kill a process without leaving and without taking note of the PID! Mark multiple processes and kill them all!

Among all the features, the manpage says you can press F to follow a process.

Really, you should try htop. I never started top again, after the first time I used htop.

Display a single process:

htop -p PID
Answered By: Denilson Sá Maia

To use that information on a script you can do this:

calcPercCpu.sh

#!/bin/bash
nPid=$1;
nTimes=10; # customize it
delay=0.1; # customize it
strCalc=`top -d $delay -b -n $nTimes -p $nPid 
  |grep $nPid 
  |sed -r -e "s;ss*; ;g" -e "s;^ *;;" 
  |cut -d' ' -f9 
  |tr 'n' '+' 
  |sed -r -e "s;(.*)[+]$;1;" -e "s/.*/scale=2;(&)/$nTimes/"`;
nPercCpu=`echo "$strCalc" |bc -l`
echo $nPercCpu

use like: calcPercCpu.sh 1234 where 1234 is the pid

For the specified $nPid, it will measure the average of 10 snapshots of the cpu usage in a whole of 1 second (delay of 0.1s each * nTimes=10); that provides a good and fast accurate result of what is happening in the very moment.

Tweak the variables to your needs.

Answered By: Aquarius Power

If you need the averages for a period of time of a specific process, try the accumulative -c option of top:

top -c a -pid PID

“-c a” found in top for Mac 10.8.5.

For Scientific Linux, the option is -S, that can be set interactively.

Answered By: Kieleth

If you know process name you can use

top -p $(pidof <process_name>)
Answered By: utarid

Launch a program and monitor it

This form is useful if you want to benchmark an executable easily:

topp() (
  if [ -n "$O" ]; then
    $* &
  else
    $* &>/dev/null &
  fi
  pid="$!"
  trap "kill $pid" SIGINT
  o='%cpu,%mem,vsz,rss'
  printf '%sn' "$o"
  i=0
  while s="$(ps --no-headers -o "$o" -p "$pid")"; do
    printf "$i $sn"
    i=$(($i + 1))
    sleep "${T:-0.1}"
  done
)

Usage:

topp ./myprog arg1 arg2

Sample output:

%cpu,%mem,vsz
0  0.0  0.0 177584
1  0.0  0.1 588024
2  0.0  0.1 607084
3  0.0  0.2 637248
4  0.0  0.2 641692
5 68.0  0.2 637904
6 80.0  0.2 642832

where vsz is the total memory usage in KiB, e.g. the above had about 600MiB usage.

If your program finishes, the loop stops and we exit topp.

Alternatively, if you git Ctrl + C, the program also stops due to the trap: https://stackoverflow.com/questions/360201/how-do-i-kill-background-processes-jobs-when-my-shell-script-exits

The options are:

  • T=0.5 topp ./myprog: change poll interval
  • O=1 topp ./myprog: don’t hide program stdout/stderr. This can be useful to help correlate at which point memory usage bursts with stdout.

ps vs top on instantaneous CPU% usage

Note that the CPU usage given by ps above is not "instantaneous", but rather the average over the processes’ lifetime as mentioned at: Top and ps not showing the same cpu result

That thread as well as: https://stackoverflow.com/questions/1332861/how-can-i-determine-the-current-cpu-utilization-from-the-shell/1332955#1332955 suggest that the Linux kernel does not store any more intermediate usage statistics, so the only way to do that would be to poll and calculate for the previous period, which is what top does.

We could therefore use top -n1 instead of ps if we wanted that:

toppp() (
  $* &>/dev/null &
  pid="$!"
  trap exit SIGINT
  i=1
  top -b n1 -d "${T:-0.1}" -n1 -p "$pid"
  while true; do top -b n1 -d "${T:-0.1}" -n1 -p "$pid"  | tail -1; printf "$i "; i=$(($i + 1)); done
)

as mentioned e.g. at: https://stackoverflow.com/a/62421136/895245 which produces output of type:


top - 17:36:59 up  9:25, 12 users,  load average: 0.32, 1.75, 2.21
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s): 13.4 us,  2.5 sy,  0.0 ni, 84.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  31893.7 total,  13904.3 free,  15139.8 used,   2849.7 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.  16005.5 avail Mem

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
 706287 ciro      20   0  590436  40352  20568 R 106.7   0.1   0:00.16 node
 706287 ciro      20   0  607060  57172  21340 R 126.7   0.2   0:00.35 node
1  706287 ciro      20   0  642008  80276  21812 R 113.3   0.2   0:00.52 node
2  706287 ciro      20   0  641676  93108  21812 R 113.3   0.3   0:00.70 node
3  706287 ciro      20   0  647892  99956  21812 R 106.7   0.3   0:00.87 node
4  706287 ciro      20   0  655980 109564  21812 R 140.0   0.3   0:01.09 node

Some related threads:

My only problems with this is that top is not as nice for interactive usage:

  • Ctrl + C does not exit the above command, not sure why trap exit is not working as it does with ps. I have to kill the command Ctrl + , and then that does not kill the process itself which continues to run on the background, which means that if it is an infinite loop like a server, I have to ps aux and then kill it.
  • the not exit automatically when the benchmarked program exits

Maybe someone more shell savvy than me can find a solution for those.

Related:

Tested on Ubuntu 21.10.

If you have a cut-down Linux distribution where top does not have per process (-p) option or related options, you can parse the output of the top command for your process name to get the CPU usage information per process.

while true;  do top -bn1 | awk '/your_process_name/ {print  $8}' ; sleep 1; done

8 represents the CPU usage per process in the output of the top command in my embedded Linux distribution

Answered By: Razan Paul

Procpath

2020 update (Linux/procfs-only). Returning to the problem of process analysis frequently enough and not being satisfied with the solutions I described below originally, I decided to write my own. It’s a pure-Python CLI package including its couple of dependencies (no heavy Matplotlib), can potentially plot many metrics from procfs, JSONPath queries to the process tree, has basic decimation/aggregation (Ramer-Douglas-Peucker and moving average), filtering by time ranges and PIDs, and a couple of other things.

pip3 install --user procpath

Here’s an example with Firefox. This records all processes with "firefox" in their cmdline (query by a PID would look like '$..children[?(@.stat.pid == 42)]') 120 times one time per second.

procpath record -i 1 -r 120 -d ff.sqlite '$..children[?("firefox" in @.cmdline)]'

Plotting RSS and CPU usage of a single process (or several) out of all recorded would look like:

procpath plot -d ff.sqlite -q cpu -p 123 -f cpu.svg
procpath plot -d ff.sqlite -q rss -p 123 -f rss.svg

Charts look like this (they are actually interactive Pygal SVGs):

RSS
CPU

psrecord

The following addresses history graph of some sort. Python psrecord package does exactly this.

pip install psrecord                             # local user install
sudo apt-get install python-matplotlib python-tk # for plotting; or via pip

For single process it’s the following (stopped by Ctrl+C):

psrecord $(pgrep proc-name1) --interval 1 --plot plot1.png

For several processes the following script is helpful to synchronise the charts:

#!/bin/bash    
psrecord $(pgrep proc-name1) --interval 1 --duration 60 --plot plot1.png &
P1=$!
psrecord $(pgrep proc-name2) --interval 1 --duration 60 --plot plot2.png &
P2=$!
wait $P1 $P2
echo 'Done'

Charts look like:
psrecord example

memory_profiler

The package provides RSS-only sampling (plus some Python-specific options). It can also record process with its children processes (see mprof --help).

pip install memory_profiler
mprof run /path/to/executable
mprof plot

By default this pops up a Tkinter-based (python-tk may be needed) chart explorer which can be exported:

mprof

graphite-stack & statsd

It may seem an overkill for a simple one-off test, but for something like a several-day debugging it’s, for sure, reasonable. A handy all-in-one raintank/graphite-stack (from Grafana’s authors) image and psutil and statsd client. procmon.py provides an implementation.

$ docker run --rm -p 8080:3000 -p 8125:8125/udp raintank/graphite-stack

Then in another terminal, after starting target process:

$ sudo apt-get install python-statsd python-psutil # or via pip
$ python procmon.py -s localhost -f chromium -r 'chromium.*'

Then opening Grafana at http://localhost:8080, authentication as admin:admin, setting up datasource https://localhost, you can plot a chart like:

grafana chart

graphite-stack & telegraf

Instead of Python script sending the metrics to Statsd, telegraf (and procstat input plugin) can be used to send the metrics to Graphite directly.

Minimal telegraf configuration looks like:

[agent]
  interval = "1s"

[[outputs.graphite]]
  servers = ["localhost:2003"]
  prefix = "testprfx"

[[inputs.procstat]]
  pid_file = "/path/to/file/with.pid"

Then run line telegraf --config minconf.conf. Grafana part is the same, except metrics names.

pidstat

pidstat (part of sysstat package) can produce output that can be easily parsed. It’s useful in case when you need extra metrics from the process(es), e.g. most useful 3 groups (CPU, memory and disk) contain: %usr, %system, %guest, %CPU, minflt/s, majflt/s, VSZ, RSS, %MEM, kB_rd/s, kB_wr/s, kB_ccwr/s. I described it in a related answer.

Answered By: saaj

Using top and awk one could easily create e.g. a comma separated log of %CPU ($9) + %MEM ($10) usage that can later be fed into any statistics and graphing tool.

top -b -d $delay -p $pid | awk -v OFS="," '$1+0>0 {
print strftime("%Y-%m-%d %H:%M:%S"),$1,$NF,$9,$10; fflush() }'

Output will be like

2019-03-26 17:43:47,2991,firefox,13.0,5.2
2019-03-26 17:43:48,2991,firefox,4.0,5.2
2019-03-26 17:43:49,2991,firefox,64.0,5.3
2019-03-26 17:43:50,2991,firefox,71.3,5.4
2019-03-26 17:43:51,2991,firefox,67.0,5.4

This won’t give good results for large $delay, though, because the printed timestamp is actually $delay behind due to how top‘s output works. Without going into too much detail, 1 simple way around this is to log the time provided by top:

top -b -d $delay -p $pid | awk -v OFS="," '$1=="top"{ time=$3 }
$1+0>0 { print time,$1,$NF,$9,$10; fflush() }'

Then the timestamp is accurate, but output will still be delayed by $delay.

Answered By: xebeche

Not enough reputation to comment, but for psrecord you can also call it directly, in a programmatic way, directly in Python:

from psrecord.main import monitor
monitor(<pid number>, logfile = "./test.log", plot="./fig.png", include_children=True)
Answered By: ZettaCircl

I’m a bit late here but I’ll share my command line trick using just the default ps

WATCHED_PID=$({ command_to_profile >log.stdout 2>log.stderr & } && echo $!);
while ps -p $WATCHED_PID --no-headers --format "etime pid %cpu %mem rss"; do 
   sleep 1 
done

I use this as a one-liner. Here the first line fires the command and stores the PID in the variable. Then ps will print the elapsed time, the PID the percent CPU using, the percent memory, and the RSS memory. You can add other fields as well.

As soon as the process ends, the ps command won’t return “success” and the while loop will end.

You can ignore the first line if the PID you want to profile is already running. Just place the desired id in the variable.

You’ll get an output like this:

  00:00  7805  0.0  0.0  2784
  00:01  7805 99.0  0.8 63876
  00:02  7805 99.5  1.3 104532
  00:03  7805  100  1.6 129876
  00:04  7805  100  2.1 170796
  00:05  7805  100  2.9 234984
  00:06  7805  100  3.7 297552
  00:07  7805  100  4.0 319464
  00:08  7805  100  4.2 337680
  00:09  7805  100  4.5 358800
  00:10  7805  100  4.7 371736
  ....
Answered By: theist

pidstat

Show CPU statistics at a 2-second interval for 2 times, of PID 7994:

pidstat -p 7994 2 2

03:54:43 PM   UID       PID    %usr %system  %guest    %CPU   CPU  Command
03:54:45 PM     0      7994    1.50    1.50    0.00    3.00     1  AliYunDun
03:54:47 PM     0      7994    1.00    1.00    0.00    2.00     0  AliYunDun

More:

# Show page faults and memory utilization:
pidstat -r

# Show input/output usage per process id:
pidstat -d

# Show information on a specific PID:
pidstat -p PID

# Show memory statistics for all processes whose command name include "fox" or "bird":
pidstat -C "fox|bird" -r -p ALL
Answered By: 赵宝磊

MacOS solution to create the following graph

plotted data of process cpu consumption

# Install dependencies
brew install gnuplot libmagic 

# Sample process. Replace 1234 with process ID
while :;do ps -p 1234 -o %cpu= >> procdata.txt;sleep 1;done

# Plot
gnuplot<<<'set term png;set output "procplot.png";plot "procdata.txt" with boxes'
Answered By: Halil

Monitoring memory usage is something I frequently need when testing C++ apps. I used the solutions already provided in the previous answers and I also wrote a little app for myself and I made it available here in case anyone else needs it in the future: https://github.com/carlonluca/procweb.

It is a binary written in Rust (there is also a version written in Qt in the repo) that monitors a process by sampling RAM/IO/CPU etc… The binary also starts a web server to let the user inspect data:

procweb

The binary stores all the samples, the chart range and scale can be tuned, you can download a CSV and the chart itself. Data is kept in memory until the sampler process is killed. The page can be freely refreshed without losing data.

Can be installed through Cargo: cargo install procweb-rust. Static binaries for x64, arm64 and armhf can also be downloaded from the GitHub repo.

More info here.

Answered By: Luca Carlon

bash script tracking resources of a process

Here some example script, which might come handy. Works just with ps and top. As an example process I chose a python script (high cpu utilization, 3 seconds break, high cpu utilization). You get also the output to a file.

Using tee gives problems with capturing the process id. Hence the tail command.

script

#!/bash/bin
set -e

LOG_OUTPUT="output.log"
LOG_RESOURCES="resources.log"

PYTHON_CODE="
import numpy as np
from datetime import datetime
import time

arr = np.zeros(1000)

print('start', datetime.now(), flush=True)
for ii in range(5000000):  # work
    arr += 1
    
print('break start', datetime.now(), flush=True)
time.sleep(3)  # break
print('break end', datetime.now(), flush=True)

for ii in range(5000000):  # work
    arr += 1
print('end', datetime.now(), flush=True)
"

rm -f ${LOG_OUTPUT}
rm -f ${LOG_RESOURCES}

log_process () {
  while ps -p $1 > /dev/null
  do
    top -p $1 -b -d 1 -n 1 >> $LOG_RESOURCES
    printf "nn" >> $LOG_RESOURCES
    sleep 1.
  done
}

python -c "${PYTHON_CODE}" >> ${LOG_OUTPUT} 2>&1 &  # run python in background
PID_PYTHON=$!  # python process id
echo "PID_PYTHON=${PID_PYTHON}"
tail -f ${LOG_OUTPUT} &  # show output on terminal
log_process $PID_PYTHON  # log needed resources to file

terminal output

$ bash monitor_python_script.sh 
PID_PYTHON=6807
start 2023-05-04 10:08:56.510581
end 2023-05-04 10:09:01.770897
break start 2023-05-04 10:09:04.280212
break end 2023-05-04 10:09:07.283365
end 2023-05-04 10:09:14.875994

log file output: output.log

start 2023-05-04 10:08:56.510581
break start 2023-05-04 10:09:04.280212
break end 2023-05-04 10:09:07.283365
end 2023-05-04 10:09:14.875994

log file resources: resources.log

top - 10:08:56 up  1:47,  0 users,  load average: 0.08, 0.10, 0.09
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s): 16.1 us, 10.4 sy,  0.0 ni, 73.5 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  34244.4 total,  29084.9 free,   3086.8 used,   2072.7 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30686.5 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 R 100.0   0.1   0:00.38 python


top - 10:08:57 up  1:47,  0 users,  load average: 0.08, 0.10, 0.09
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s): 14.6 us,  0.5 sy,  0.0 ni, 84.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  34244.4 total,  29083.8 free,   3087.9 used,   2072.7 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30685.5 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 R 100.0   0.1   0:01.53 python


top - 10:08:58 up  1:47,  0 users,  load average: 0.23, 0.13, 0.10
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s): 15.2 us,  0.0 sy,  0.0 ni, 84.4 id,  0.5 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  34244.4 total,  29083.9 free,   3087.8 used,   2072.8 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30685.6 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 R 100.0   0.1   0:02.69 python


top - 10:09:00 up  1:47,  0 users,  load average: 0.23, 0.13, 0.10
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s): 14.3 us,  0.0 sy,  0.0 ni, 85.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  34244.4 total,  29083.1 free,   3088.5 used,   2072.8 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30684.9 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 R 100.0   0.1   0:03.85 python


top - 10:09:01 up  1:47,  0 users,  load average: 0.23, 0.13, 0.10
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s): 14.3 us,  0.0 sy,  0.0 ni, 85.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  34244.4 total,  29083.3 free,   3088.3 used,   2072.8 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30685.1 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 R 100.0   0.1   0:05.01 python


top - 10:09:02 up  1:47,  0 users,  load average: 0.23, 0.13, 0.10
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s):  7.1 us,  0.5 sy,  0.0 ni, 92.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.5 st
MiB Mem :  34244.4 total,  29096.4 free,   3075.2 used,   2072.8 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30698.1 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 R 100.0   0.1   0:06.17 python


top - 10:09:03 up  1:47,  0 users,  load average: 0.29, 0.14, 0.11
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s):  7.1 us,  0.0 sy,  0.0 ni, 92.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  34244.4 total,  29096.4 free,   3075.2 used,   2072.8 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30698.1 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 R 100.0   0.1   0:07.32 python


top - 10:09:04 up  1:47,  0 users,  load average: 0.29, 0.14, 0.11
Tasks:   1 total,   0 running,   1 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 :  34244.4 total,  29096.9 free,   3074.7 used,   2072.8 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30698.6 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 S   0.0   0.1   0:08.05 python


top - 10:09:05 up  1:47,  0 users,  load average: 0.29, 0.14, 0.11
Tasks:   1 total,   0 running,   1 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.5 us,  0.0 sy,  0.0 ni, 99.5 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  34244.4 total,  29096.6 free,   3074.9 used,   2073.0 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30698.3 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 S   0.0   0.1   0:08.05 python


top - 10:09:07 up  1:47,  0 users,  load average: 0.29, 0.14, 0.11
Tasks:   1 total,   0 running,   1 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.4 us,  0.5 sy,  0.0 ni, 98.1 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  34244.4 total,  29087.0 free,   3084.6 used,   2072.8 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30688.8 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 S   0.0   0.1   0:08.05 python


top - 10:09:08 up  1:47,  0 users,  load average: 0.29, 0.14, 0.11
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s):  7.6 us,  0.0 sy,  0.0 ni, 92.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  34244.4 total,  29086.5 free,   3085.1 used,   2072.9 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30688.4 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 R 100.0   0.1   0:08.95 python


top - 10:09:09 up  1:47,  0 users,  load average: 0.35, 0.16, 0.11
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s):  8.1 us,  0.0 sy,  0.0 ni, 91.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  34244.4 total,  29086.7 free,   3084.9 used,   2072.9 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30688.6 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 R 100.0   0.1   0:10.11 python


top - 10:09:10 up  1:47,  0 users,  load average: 0.35, 0.16, 0.11
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s):  8.0 us,  0.0 sy,  0.0 ni, 92.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  34244.4 total,  29087.0 free,   3084.5 used,   2072.9 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30688.9 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 R 100.0   0.1   0:11.27 python


top - 10:09:11 up  1:47,  0 users,  load average: 0.35, 0.16, 0.11
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s):  8.1 us,  0.0 sy,  0.0 ni, 91.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  34244.4 total,  29086.5 free,   3085.1 used,   2072.9 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30688.4 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 R 100.0   0.1   0:12.43 python


top - 10:09:12 up  1:47,  0 users,  load average: 0.35, 0.16, 0.11
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s):  7.1 us,  0.0 sy,  0.0 ni, 92.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  34244.4 total,  29086.3 free,   3085.3 used,   2072.9 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30688.2 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 R 100.0   0.1   0:13.59 python


top - 10:09:13 up  1:47,  0 users,  load average: 0.40, 0.17, 0.12
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s):  8.1 us,  0.0 sy,  0.0 ni, 91.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  34244.4 total,  29086.2 free,   3085.3 used,   2072.9 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.  30688.1 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6807 user      20   0  532700  28592  14444 R 100.0   0.1   0:14.74 python
Answered By: Markus Dutschke
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.