0

I need to examine how my CPU is performing. I could simply open the task manager, but I will have to sit in front of the monitor long time. My problem is that CPU seems to be spiking or overloading and crashing all the programs that are running. So, I want to be able to log it somewhere say every second or so. Is there way to log CPU load?

  • cognitivedissonance.ca/cogware/plog <- Tracks per process and not the system as a whole. – goldilocks Jan 25 '17 at 15:30
  • I am looking for overall cpu load not per process – ThN Jan 25 '17 at 16:04
  • @goldilocks: with a theme like that, the software must be trustworthy :P – Jacobm001 Jan 25 '17 at 16:24
  • @goldilocks I have tried the answer. Apparently, syrupy is not part of the repository and my Pi already has top but that doesn't log. – ThN Jan 25 '17 at 17:07
  • I'll reopen this since it is a bit more focussed than the duplicate; if all you want is CPU time there are various ways to do this. See here for some ideas (I'll recommend just skipping to the second half of my answer there about parsing /proc/stat). – goldilocks Jan 25 '17 at 17:13
1

You can run top without reloading and write its output to a log to analyze it later.

while sleep 1; do top -n1 >> cpu.log; done

  • I suppose you run this on the terminal. I did that and got bash syntax error it is complaining about the semicolon. – ThN Jan 27 '17 at 13:57
  • whats your bash version? i tested it with GNU bash, Version 4.3.42(1)-release (x86_64-redhat-linux-gnu) (fixed semicolon) – mperlet Jan 31 '17 at 9:18
  • mine is 4.3.30(1)-release – ThN Jan 31 '17 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.