summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Nedotsukov <bland@FreeBSD.org>2003-09-09 03:36:00 +0000
committerAlexander Nedotsukov <bland@FreeBSD.org>2003-09-09 03:36:00 +0000
commit03beced67b3d5ebb1b0117b068be5d73dfe14bc6 (patch)
tree49dd7e2b2296fca5ad474fcd1019a7af9455c04e
parent- Fixes in proctime calculation. (diff)
- glibtop_get_proclist() is not supposed to return sorted
list as it obviously is on Linux. Sort it before use. - cpu and process time is not necesarily measured with same frequency. Make them same base.
Notes
Notes: svn path=/head/; revision=88831
-rw-r--r--sysutils/gnome-system-monitor/Makefile1
-rw-r--r--sysutils/gnome-system-monitor/files/patch-src::proctable.c53
-rw-r--r--sysutils/gnomesystemmonitor/Makefile1
-rw-r--r--sysutils/gnomesystemmonitor/files/patch-src::proctable.c53
4 files changed, 108 insertions, 0 deletions
diff --git a/sysutils/gnome-system-monitor/Makefile b/sysutils/gnome-system-monitor/Makefile
index 9eac079eed93..570f8c96e235 100644
--- a/sysutils/gnome-system-monitor/Makefile
+++ b/sysutils/gnome-system-monitor/Makefile
@@ -7,6 +7,7 @@
PORTNAME= gnomesystemmonitor
PORTVERSION= 2.0.5
+PORTREVISION= 1
CATEGORIES= sysutils gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= sources/gnome-system-monitor/2.0
diff --git a/sysutils/gnome-system-monitor/files/patch-src::proctable.c b/sysutils/gnome-system-monitor/files/patch-src::proctable.c
new file mode 100644
index 000000000000..5cb348a5aabb
--- /dev/null
+++ b/sysutils/gnome-system-monitor/files/patch-src::proctable.c
@@ -0,0 +1,53 @@
+--- src/proctable.c.orig Sat Jun 7 04:35:32 2003
++++ src/proctable.c Thu Sep 4 16:29:18 2003
+@@ -539,6 +539,9 @@
+ glibtop_get_proc_uid (&procuid, pid);
+ glibtop_get_proc_time (&proctime, pid);
+ newcputime = proctime.utime + proctime.stime;
++ if (proctime.frequency) {
++ newcputime /= (proctime.frequency/100);
++ }
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (procdata->tree));
+
+ info->mem = procmem.size;
+@@ -620,6 +623,9 @@
+ glibtop_get_proc_uid (&procuid, pid);
+ glibtop_get_proc_time (&proctime, pid);
+ newcputime = proctime.utime + proctime.stime;
++ if (proctime.frequency) {
++ newcputime /= (proctime.frequency/100);
++ }
+
+ arguments = glibtop_get_proc_args (&procargs, pid, 0);
+ get_process_name (procdata, info, procstate.cmd, arguments);
+@@ -709,12 +715,20 @@
+ return NULL;
+ }
+
++static int
++pid_compare(const void* first, const void* second)
++{
++ return *(unsigned*)first - *(unsigned*)second;
++}
++
+ static void
+ refresh_list (ProcData *data, unsigned *pid_list, gint n)
+ {
+ ProcData *procdata = data;
+ GList *list = procdata->info;
+ gint i = 0;
++
++ qsort(pid_list, n, sizeof (*pid_list), pid_compare);
+
+ while (i < n)
+ {
+@@ -812,6 +826,9 @@
+ ** should probably have a total_time_last gint in the ProcInfo structure */
+ glibtop_get_cpu (&cpu);
+ total_time = cpu.total - total_time_last;
++ if (cpu.frequency) {
++ total_time /= (cpu.frequency/100);
++ }
+ total_time_last = cpu.total;
+
+ refresh_list (procdata, pid_list, n);
diff --git a/sysutils/gnomesystemmonitor/Makefile b/sysutils/gnomesystemmonitor/Makefile
index 9eac079eed93..570f8c96e235 100644
--- a/sysutils/gnomesystemmonitor/Makefile
+++ b/sysutils/gnomesystemmonitor/Makefile
@@ -7,6 +7,7 @@
PORTNAME= gnomesystemmonitor
PORTVERSION= 2.0.5
+PORTREVISION= 1
CATEGORIES= sysutils gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= sources/gnome-system-monitor/2.0
diff --git a/sysutils/gnomesystemmonitor/files/patch-src::proctable.c b/sysutils/gnomesystemmonitor/files/patch-src::proctable.c
new file mode 100644
index 000000000000..5cb348a5aabb
--- /dev/null
+++ b/sysutils/gnomesystemmonitor/files/patch-src::proctable.c
@@ -0,0 +1,53 @@
+--- src/proctable.c.orig Sat Jun 7 04:35:32 2003
++++ src/proctable.c Thu Sep 4 16:29:18 2003
+@@ -539,6 +539,9 @@
+ glibtop_get_proc_uid (&procuid, pid);
+ glibtop_get_proc_time (&proctime, pid);
+ newcputime = proctime.utime + proctime.stime;
++ if (proctime.frequency) {
++ newcputime /= (proctime.frequency/100);
++ }
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (procdata->tree));
+
+ info->mem = procmem.size;
+@@ -620,6 +623,9 @@
+ glibtop_get_proc_uid (&procuid, pid);
+ glibtop_get_proc_time (&proctime, pid);
+ newcputime = proctime.utime + proctime.stime;
++ if (proctime.frequency) {
++ newcputime /= (proctime.frequency/100);
++ }
+
+ arguments = glibtop_get_proc_args (&procargs, pid, 0);
+ get_process_name (procdata, info, procstate.cmd, arguments);
+@@ -709,12 +715,20 @@
+ return NULL;
+ }
+
++static int
++pid_compare(const void* first, const void* second)
++{
++ return *(unsigned*)first - *(unsigned*)second;
++}
++
+ static void
+ refresh_list (ProcData *data, unsigned *pid_list, gint n)
+ {
+ ProcData *procdata = data;
+ GList *list = procdata->info;
+ gint i = 0;
++
++ qsort(pid_list, n, sizeof (*pid_list), pid_compare);
+
+ while (i < n)
+ {
+@@ -812,6 +826,9 @@
+ ** should probably have a total_time_last gint in the ProcInfo structure */
+ glibtop_get_cpu (&cpu);
+ total_time = cpu.total - total_time_last;
++ if (cpu.frequency) {
++ total_time /= (cpu.frequency/100);
++ }
+ total_time_last = cpu.total;
+
+ refresh_list (procdata, pid_list, n);