user4647247
user4647247

Reputation:

Dstat CPU usage for one specific process

Is it possible to measure the CPU and memory for one specific process with dstat? There is possiblilities to measure the most consuming CPU with --top-cputime but is it possible to measure a specific one?

I want to write to a file with --output to make a graph of it later, not with ">" operator.

Upvotes: 11

Views: 5835

Answers (2)

Dag Wieers
Dag Wieers

Reputation: 1913

No, this is not possible with dstat currently.

I always envisioned to make this possible, but never got around to doing it.

Upvotes: 11

Farshad
Farshad

Reputation: 1485

You can use command | grep specific_text

for example test dstat | grep puppet

to saving output result in a log file you have two options :

using --output file dstat --time --cpu --top-cputime --output /tmp/dstat.log | grep puppet

using command > file dstat --time --cpu --top-cputime > /tmp/dstat.log | grep puppet

for appendind logs : dstat --time --cpu --top-cputime >> /tmp/dstat.log | grep puppet

here is screenshots of both commands

According to your comments may these commands helps you :

(1) save stats in a file dstat --time --cpu --top-cputime --output my.log

(2) apply filtering to log file and save results to file cat my.log | grep httpd > myhttpd.log

(3) final results cat myhttpd.log

see the screenshot of results here

Upvotes: -3

Related Questions