summaryrefslogtreecommitdiff
path: root/src/procproperties.cpp
diff options
context:
space:
mode:
authormonsta <[email protected]>2015-12-01 17:50:17 +0300
committermonsta <[email protected]>2015-12-01 17:50:17 +0300
commit5e203bc024a3d8a34921ae237ae595002889bf12 (patch)
tree9c01ca9d81f2d20ae44895037b6d786295a19d80 /src/procproperties.cpp
parenteeeaff5770c91943baa3c506da3d05b7092c7690 (diff)
downloadmate-system-monitor-5e203bc024a3d8a34921ae237ae595002889bf12.tar.bz2
mate-system-monitor-5e203bc024a3d8a34921ae237ae595002889bf12.tar.xz
process properties: use proper format for "CPU time" property
it should be the same as in "CPU time" column of process table now adapted from https://git.gnome.org/browse/gnome-system-monitor/commit/?id=3c1f17877f95fcac7f5d437739305e245af7ba8b
Diffstat (limited to 'src/procproperties.cpp')
-rw-r--r--src/procproperties.cpp20
1 files changed, 1 insertions, 19 deletions
diff --git a/src/procproperties.cpp b/src/procproperties.cpp
index bc4993c..2e6cda9 100644
--- a/src/procproperties.cpp
+++ b/src/procproperties.cpp
@@ -24,12 +24,6 @@
#include <glibtop/procmem.h>
#include <glibtop/procmap.h>
#include <glibtop/procstate.h>
-#if defined (__linux__)
-#include <asm/param.h>
-#elif defined (__NetBSD__) || defined (__OpenBSD__)
-#include <sys/param.h>
-#include <sys/sysctl.h>
-#endif
#include "procman.h"
#include "procproperties.h"
@@ -115,18 +109,6 @@ fill_proc_properties (GtkWidget *tree, ProcInfo *info)
get_process_memory_info(info);
-#if defined (__NetBSD__) || defined (__OpenBSD__)
- struct clockinfo cinf;
- size_t size = sizeof (cinf);
- int HZ;
- int mib[] = { CTL_KERN, KERN_CLOCKRATE };
-
- if (sysctl (mib, G_N_ELEMENTS (mib), &cinf, &size, NULL, 0) == -1)
- HZ = 100;
- else
- HZ = cinf.hz;
-#endif
-
proc_arg proc_props[] = {
{ N_("Process Name"), g_strdup_printf("%s", info->name)},
{ N_("User"), g_strdup_printf("%s (%d)", info->user.c_str(), info->uid)},
@@ -138,7 +120,7 @@ fill_proc_properties (GtkWidget *tree, ProcInfo *info)
{ N_("Shared Memory"), format_memsize(info->memshared)},
{ N_("X Server Memory"), format_memsize(info->memxserver)},
{ N_("CPU"), g_strdup_printf("%d%%", info->pcpu)},
- { N_("CPU Time"), g_strdup_printf(ngettext("%lld second", "%lld seconds", info->cpu_time/HZ), (unsigned long long)info->cpu_time/HZ) },
+ { N_("CPU Time"), procman::format_duration_for_display(100 * info->cpu_time / ProcData::get_instance()->frequency) },
{ N_("Started"), procman_format_date_for_display(info->start_time) },
{ N_("Nice"), g_strdup_printf("%d", info->nice)},
{ N_("Priority"), g_strdup_printf("%s", procman::get_nice_level(info->nice)) },