You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
311 B
Bash
11 lines
311 B
Bash
#!/bin/bash
|
|
|
|
# first argument is the process ID
|
|
pid="$1"
|
|
|
|
# number of CPUs available
|
|
nproc=$(nproc --all)
|
|
|
|
# hacky way to print the content of a CSV file containing CPU/Mem usage of the process
|
|
top -bn2 -p $pid | awk -v nproc=$nproc 'NR > 16 {$12=substr($0,72); printf "CPU, MEM\n%.2f, %.2f\n", $9/nproc, $10}'
|