aboutsummaryrefslogtreecommitdiff
path: root/sysutils/xfce4-cpugraph-plugin
diff options
context:
space:
mode:
authorRene Ladan <rene@FreeBSD.org>2011-12-18 20:29:15 +0000
committerRene Ladan <rene@FreeBSD.org>2011-12-18 20:29:15 +0000
commitc73fdec9ac95b83fef0e714ceff586fc5c7451c1 (patch)
treefdfb6e62a3102b73f1c013ed4bade72c460e37f9 /sysutils/xfce4-cpugraph-plugin
parent776047b0fd8dd0380ae895ece294a00ab18f2b71 (diff)
downloadports-c73fdec9ac95b83fef0e714ceff586fc5c7451c1.tar.gz
ports-c73fdec9ac95b83fef0e714ceff586fc5c7451c1.zip
- Add support for multiple cores [1]
- Bump PORTREVISION [1] - Move over to xfce@ [2] PR: ports/163430 [1] Submitted by: myself [1] Approved by: Olivier Duchateau [1] [2]
Notes
Notes: svn path=/head/; revision=287616
Diffstat (limited to 'sysutils/xfce4-cpugraph-plugin')
-rw-r--r--sysutils/xfce4-cpugraph-plugin/Makefile4
-rw-r--r--sysutils/xfce4-cpugraph-plugin/files/patch-panel-plugin__os.c57
2 files changed, 59 insertions, 2 deletions
diff --git a/sysutils/xfce4-cpugraph-plugin/Makefile b/sysutils/xfce4-cpugraph-plugin/Makefile
index 13f31eeab3c0..a28bbf53fa9d 100644
--- a/sysutils/xfce4-cpugraph-plugin/Makefile
+++ b/sysutils/xfce4-cpugraph-plugin/Makefile
@@ -7,13 +7,13 @@
PORTNAME= xfce4-cpugraph-plugin
PORTVERSION= 1.0.1
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= sysutils xfce
MASTER_SITES= ${MASTER_SITE_XFCE}
MASTER_SITE_SUBDIR= src/panel-plugins/${PORTNAME}/${PORTVERSION:R}
DIST_SUBDIR= xfce4
-MAINTAINER= duchateau.olivier@gmail.com
+MAINTAINER= xfce@FreeBSD.org
COMMENT= Xfce4 systemload plugin with multiple CPU display modes
GNU_CONFIGURE= yes
diff --git a/sysutils/xfce4-cpugraph-plugin/files/patch-panel-plugin__os.c b/sysutils/xfce4-cpugraph-plugin/files/patch-panel-plugin__os.c
new file mode 100644
index 000000000000..0faad0cb5765
--- /dev/null
+++ b/sysutils/xfce4-cpugraph-plugin/files/patch-panel-plugin__os.c
@@ -0,0 +1,57 @@
+--- panel-plugin/os.c.orig 2010-11-07 13:58:22.000000000 +0100
++++ panel-plugin/os.c 2011-12-18 13:52:22.000000000 +0100
+@@ -134,28 +134,41 @@
+ #elif defined (__FreeBSD__)
+ guint detect_cpu_number()
+ {
+- return 1;
++ static gint mib[] = {CTL_HW, HW_NCPU};
++ gint ncpu;
++ gsize len = sizeof( gint );
++ if( sysctl( mib, 2, &ncpu, &len, NULL, 0 ) < 0 )
++ return 0;
++ else
++ return ncpu;
+ }
+
+ gboolean read_cpu_data( CpuData *data, guint nb_cpu)
+ {
+ glong used, total;
+- glong cp_time[CPUSTATES];
++ glong cp_time[CPUSTATES * nb_cpu];
++ glong *cp_time1;
+ gsize len = sizeof( cp_time );
++ gint i;
+
+- if( sysctlbyname( "kern.cp_time", &cp_time, &len, NULL, 0 ) < 0 )
++ data[0].load = 0;
++ if( sysctlbyname( "kern.cp_times", &cp_time, &len, NULL, 0 ) < 0 )
+ return FALSE;
++ for (i = 1; i <= nb_cpu; i++ )
++ {
++ cp_time1 = cp_time + CPUSTATES * (i - 1);
++ used = cp_time1[CP_USER] + cp_time1[CP_NICE] + cp_time1[CP_SYS] + cp_time1[CP_INTR];
++ total = used + cp_time1[CP_IDLE];
++ if( (total - data[i].previous_total) != 0 )
++ data[i].load = (CPU_SCALE * (used - data[i].previous_used))/(total - data[i].previous_total);
++ else
++ data[i].load = 0;
+
+- used = cp_time[CP_USER] + cp_time[CP_NICE] + cp_time[CP_SYS] + cp_time[CP_INTR];
+- total = used + cp_time[CP_IDLE];
+- if( (total - data[0].previous_total) != 0 )
+- data[0].load = (CPU_SCALE * (used - data[0].previous_used))/(total - data[0].previous_total);
+- else
+- data[0].load = 0;
+-
+- data[0].previous_used = used;
+- data[0].previous_total = total;
+-
++ data[i].previous_used = used;
++ data[i].previous_total = total;
++ data[0].load += data[i].load;
++ }
++ data[0].load /= nb_cpu;
+ return TRUE;
+ }
+