![]() System's general heath or trying to determine what your system wasĭoing at some time in the past. These can include benchmarking, monitoring a There are a number of times in which you find yourself needing Rather than writing scripts yourself, you could use collectl and perhaps combine that with graphite and grafana to visualise the results. Top -n 1 -b | head -n 3 | tail -n 1 > /tmp/top-cpu-summary.log Printf "top CPU(s) summary for %s\n" "$now" > /tmp/top-cpu-summary.log # PARM: $1 number of seconds to run, ie 2 hours = 7200 # with time stamp in hh:mm:ss 24 hour format. # DESC: Call `top` command every second to obtain CPU(s) stats for Similar to the first section, create a bash script to loop 7,200 seconds: #!/bin/bash Using top command to get us, sy, id and si CPU values NOTE: replace user with your actual user name. To use the top command to see the 10 most resource intensive processes use this command instead of the uptime command: top -n 1 -b | head -n 17 | tail -n 10 > /home/user/top10.log Using top command to see top 10 processes Once again any value over 0.70 deserves investigation and when it hits 1.00 your system is stalling. So divide the load average 1.39 by 8 and the TRUE load average is 0.17 which is very respectable. But I digress, the important thing is to count how many CPUs there are which is 8. ![]() In this snapshot CPU#1 (called CPU0 internally) is running at 2,0749.68 Mhz and CPU#8 is running at 1,7781.56 Mhz. This shows there are 8 CPUs (it's a quad-core hyper-threaded Intel i-7 3630QM laptop CPU running 1200 Mhz to 3400 Mhz). To quickly find this out use the command: $ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq However in your spreadsheet you'll have to divide the load average by the number of CPUs you have. 70 deserves investigation and 1.00 means there is a bottle-neck and processes aren't being served and have to wait. ![]() This appears dangerously high because anything over. In the example above the one minute load average is 1.39. I use Libre Office Calc but all modern spreadsheets can import the file. You can import the file cpuload.log into a spreadsheet and graph the data points over the two hours or simply scroll over the data. For simplicity sake only consider the last minute load average which is reported every second in our loop. The load average is reporting three variables-last minute, last five minutes and last fifteen minutes. To look at your output use the command: $ cat cpuload.logĢ0:04:06 up 2 days, 14 min, 1 user, load average: 1.39, 1.12, 0.95 ![]() You'll need a bash script to loop 7,200 seconds (2 hours) which would look like this: #!/bin/bash Further these stats can be segmented for each CPU, ie #1 to #8 forįor simplicity sake, I'll base this answer using average load factor similar to the answer in: How to log CPU load? Create a loop for two hours logging every second.You can choose different statistics to log: First decide which CPU stats you want to log
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |