Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting CPU utilization information

How could I get the CPU utilization with time info of a process in linux? Basically I want to let my application run overnight. At the same time, I would like to monitor the CPU utilization during the period the application is run.

I tried top | grep appName >& log, it does not seem to return me anything in the log. Could someone help me with this?

Thanks.

like image 759
leslieg Avatar asked Feb 14 '26 10:02

leslieg


1 Answers

vmstat and iostat can both give you periodic information of this nature; I would suggest either setting up the number of times manually, or putting a single poll into a cron job, and then redirecting the output to a file:

vmstat 20 4230 >> cpu_log_file

This would give you a snapshot of usage every 20 seconds for 24 hours.

like image 180
Bryan Agee Avatar answered Feb 16 '26 01:02

Bryan Agee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!