Talk:Linux CPU utilization: Difference between revisions

no edit summary
No edit summary
Line 25:
 
As per https://github.com/pcolby/scripts/issues/2 I'll update the description to specify that only the first (up to) 8 fields should be summed to calculate the total (as the 9th and 10th fields are already included in earlier ones). However, this does mean that all current solutions will be slightly incorrect, and need to updated. The Bash solution has already been updated - it was a one-line fix. Most other solutions should be nearly as simple to correct.
 
 
== Output does not match top ==
 
I was working on a similar function for my i3bar & had this issue, so I came looking for answers. Even after adapting my implementation to mimick your calculation the result still appears to differ from '''top''''s by a factor of about 10.
 
== Making implementations light ==
 
As this is an ongoing function with continual updates, it might be interesting to work on making each implementation efficient (this would also improve the actual reading).
 
For example, as I'm working with '''bash''', I've tried to implement this with builtins to avoid spawning processes.
Anonymous user