You are not logged in.

#1 2009-05-16 19:56:34

markp1989
Member
Registered: 2008-10-05
Posts: 431

looking for a bash command to show the current CPU load.

i have a very small script that i use to log the temperatures of my cpu , i use it when im doing OC tests.


#!/bin/bash
echo "Date-------------------------Core1-Core2-FAN" >> temp.log
while true; do
echo `date`    `sensors | grep "Core 0" | cut -f2 -d'+'  | cut -f1 -d'C'`    `sensors | grep "Core 1" | cut -f2 -d'+'  | cut -f1 -d'C'` `sensors | grep "fan2" | cut -f2 -d':' | cut -f1 -d'R'`  >> temp.log
sleep 1 
done

currently it gives the current output

Date-------------------------Core1-Core2-FAN
Sat May 16 20:57:00 BST 2009 43.0° 43.0° 811
Sat May 16 20:57:01 BST 2009 44.0° 44.0° 827
Sat May 16 20:57:02 BST 2009 43.0° 43.0° 827
Sat May 16 20:57:03 BST 2009 42.0° 42.0° 811
Sat May 16 20:57:04 BST 2009 42.0° 42.0° 811
Sat May 16 20:57:05 BST 2009 42.0° 42.0° 831
Sat May 16 20:57:06 BST 2009 43.0° 43.0° 831
Sat May 16 20:57:07 BST 2009 42.0° 42.0° 831
Sat May 16 20:57:08 BST 2009 43.0° 43.0° 831
Sat May 16 20:57:09 BST 2009 42.0° 42.0° 811
Sat May 16 20:57:10 BST 2009 42.0° 42.0° 811
Sat May 16 20:57:11 BST 2009 43.0° 43.0° 831
Sat May 16 20:57:12 BST 2009 46.0° 46.0° 831
Sat May 16 20:57:13 BST 2009 44.0° 44.0° 811
Sat May 16 20:57:14 BST 2009 43.0° 43.0° 811
Sat May 16 20:57:15 BST 2009 43.0° 43.0° 811
Sat May 16 20:57:16 BST 2009 54.0° 54.0° 811
Sat May 16 20:57:17 BST 2009 56.0° 56.0° 831
Sat May 16 20:57:19 BST 2009 56.0° 56.0° 831
Sat May 16 20:57:20 BST 2009 56.0° 56.0° 827
Sat May 16 20:57:21 BST 2009 56.0° 56.0° 827
Sat May 16 20:57:22 BST 2009 57.0° 57.0° 827
Sat May 16 20:57:23 BST 2009 56.0° 52.0° 1939
Sat May 16 20:57:25 BST 2009 54.0° 51.0° 1939
Sat May 16 20:57:26 BST 2009 54.0° 51.0° 1917
Sat May 16 20:57:27 BST 2009 44.0° 44.0° 1917
Sat May 16 20:57:28 BST 2009 44.0° 44.0° 1917
Sat May 16 20:57:29 BST 2009 44.0° 44.0° 1278
Sat May 16 20:57:30 BST 2009 43.0° 43.0° 1278
Sat May 16 20:57:31 BST 2009 43.0° 43.0° 878

I would like to add a cpu load colum to the log file. but i dont know of any command to do this?

Thanks Markp1989

Last edited by markp1989 (2009-05-16 19:57:58)


Desktop: E8400@4ghz - DFI Lanparty JR P45-T2RS - 4gb ddr2 800 - 30gb OCZ Vertex - Geforce 8800 GTS - 2*19" LCD
Server/Media Zotac GeForce 9300-ITX I-E - E5200 - 4gb Ram - 2* ecogreen F2 1.5tb - 1* wd green 500gb - PicoPSU 150xt - rtorrent - xbmc - ipazzport remote - 42" LCD

Offline

#2 2009-05-16 20:51:29

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: looking for a bash command to show the current CPU load.

cut -d' ' -f1-3 /proc/loadavg

Offline

#3 2009-05-17 02:28:24

damjan
Member
Registered: 2006-05-30
Posts: 451

Re: looking for a bash command to show the current CPU load.

vmstat 1

Offline

Board footer

Powered by FluxBB