It logs continuously to a set of rotating log files. Here's a logging script I wrote and use: cpu_logger.py. their command without further arguments, as in /usr/bin/firefox)Īfter you've used a Spreadsheet to create a graph to see when your CPU load went through the roof, you can then search this file for the nearest time to see what process has caused it.Ģ2:57:42 up 1 day, 4:38, 4 users, load average: 1.00, 1.26, 1.21Ģ2:57:43 up 1 day, 4:38, 4 users, load average: 0.92, 1.24, 1.21Ģ2:57:44 up 1 day, 4:38, 4 users, load average: 0.92, 1.24, 1.21Ģ2:57:45 up 1 day, 4:38, 4 users, load average: 0.92, 1.24, 1.21Ġ.8 0.5 /usr/lib/gnome-panel/clock-applet This is just the top 10, and just their CPU Usage, Memory Usage and the first argument (i.e. Note that this is not the full boat-load of information top would give you. This will append the Top 10 most CPU hungry processes to a file ps.log every five seconds. So, additionally, run this (or use his answer for this part): while true do (echo "%CPU %MEM ARGS $(date)" & ps -e -o pcpu,pmem,args -sort=pcpu | cut -d" " -f1-5 | tail) > ps.log sleep 5 done You can then import this file into Gnumeric or the OpenOffice spreadsheet to create a nice graph (select 'separated by spaces' on import).Īs Scaine noticed, this won't be enough to diagnose the problem. This will log your cpu load every second and append it to a file uptime.log. This works very well: while true do uptime > uptime.log sleep 1 done
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |