GNOME Bugzilla – Bug 498874
Add average CPU usage to graph
Last modified: 2012-08-08 19:45:16 UTC
The attached patch adds an Average line to the CPU graph (for multi-processor systems only). It's probably best viewed as a proof-of-concept. I'm not very familiar with the system-monitor code, and I didn't consider all the pitfalls. (For instance, the extra CPU might overflow the array of CPUs.) But I've tried it on both single and dual-core systems, and it seems to work. I recently set up my first dual-core Linux system. I was looking at the CPU graph, and noticed that the processors were forming a symmetrical pattern: as one line went up, the other went down, and vice versa. I quickly realized this was indicating a primarily single-threaded workload. Processes moved from one processor to the other, but the total load was relatively constant. But it was hard to see just what the load was, because the individual CPU lines were moving so much. So, I decided what I needed was a graph indicating the average CPU usage. After a bit of experimenting, I came up with this patch.
Created attachment 99458 [details] [review] Patch to add average CPU usage This patch is against 2.18.2. I've checked that it applies to the current SVN trunk, but I'm still using Gnome 2.18, so I'm not set up to compile that.
Good idea. Implementation is easy, but it would better be an option, etc. Your implementation is not correct. To get the overall CPU usage, there's nothing to do, it's already there : @@ -247,9 +247,13 @@ NOW[0][CPU_TOTAL] = cpu.total; NOW[0][CPU_USED] = cpu.user + cpu.nice + cpu.sys; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ } else { - for (i = 0; i < g->n; i++) { - NOW[i][CPU_TOTAL] = cpu.xcpu_total[i]; - NOW[i][CPU_USED] = cpu.xcpu_user[i] + cpu.xcpu_nice[i] only needs an option and a UI to configure it.
[Adding missing "QA Contact" entry so system monitor bug report changes can still be watched via the "Users to watch" list on https://bugzilla.gnome.org/userprefs.cgi?tab=email when the assignee is changed to an individual.]
I like the idea of having an option to show the average CPU usage too, but I would rather see it as a stacked area chart, as that displays both the per-core usage and the average usage in an elegant way (see example screenshot in bug 635939 - [1]). On systems with many cores, the graph is already looking strange, adding another line would only make it worse (see bug 635939). What do you think? [1] - http://bugzilla-attachments.gnome.org/attachment.cgi?id=175373
The stacked area chart looks like a good solution to me.
Thanks for the quick feedback. Based on the reporter's last comment I am marking this as a duplicate of bug 635939. *** This bug has been marked as a duplicate of bug 635939 ***