summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-03-01 14:33:15 +0300
committermonsta <[email protected]>2016-03-01 14:37:52 +0300
commitcb062d03c041122c79950216a1eaa8f263e84a51 (patch)
treeebff24f0b8f264575ea5875fc651f8c51424c8e1
parentb7c2c34a6662ee043be997c54ff1c85318818c2d (diff)
downloadmate-system-monitor-cb062d03c041122c79950216a1eaa8f263e84a51.tar.bz2
mate-system-monitor-cb062d03c041122c79950216a1eaa8f263e84a51.tar.xz
process table: show running state when CPU time changes
adapted from https://git.gnome.org/browse/gnome-system-monitor/commit/?id=da371b277e0ebbc71708f1ce91f879cfc4ab9c9f
-rw-r--r--src/proctable.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/proctable.cpp b/src/proctable.cpp
index d1a7840..cf8fdf3 100644
--- a/src/proctable.cpp
+++ b/src/proctable.cpp
@@ -819,7 +819,12 @@ update_info (ProcData *procdata, ProcInfo *info)
info->set_user(procstate.uid);
- info->pcpu = (proctime.rtime - info->cpu_time) * 100 / procdata->cpu_total_time;
+ // if the cpu time has increased reset the status to running
+ // regardless of kernel state (https://bugzilla.gnome.org/606579)
+ guint64 difference = proctime.rtime - info->cpu_time;
+ if (difference > 0)
+ info->status = GLIBTOP_PROCESS_RUNNING;
+ info->pcpu = difference * 100 / procdata->cpu_total_time;
info->pcpu = MIN(info->pcpu, 100);
if (not procdata->config.solaris_mode)