diff options
author | Ion-Mihai Tetcu <itetcu@FreeBSD.org> | 2006-07-10 20:10:32 +0000 |
---|---|---|
committer | Ion-Mihai Tetcu <itetcu@FreeBSD.org> | 2006-07-10 20:10:32 +0000 |
commit | 0576c8295091ecc58a2fcd73254d10b0dce01c67 (patch) | |
tree | 75409b9f87c1c35220da6bfd16d85426d92bd1a9 /x11/e17-module-cpu | |
parent | e7022df49ceeeffe0494d3d26e73878d0033ebc9 (diff) | |
download | ports-0576c8295091ecc58a2fcd73254d10b0dce01c67.tar.gz ports-0576c8295091ecc58a2fcd73254d10b0dce01c67.zip |
Notes
Diffstat (limited to 'x11/e17-module-cpu')
-rw-r--r-- | x11/e17-module-cpu/Makefile | 36 | ||||
-rw-r--r-- | x11/e17-module-cpu/distinfo | 3 | ||||
-rw-r--r-- | x11/e17-module-cpu/files/patch-configure | 11 | ||||
-rw-r--r-- | x11/e17-module-cpu/files/patch-e_mod_main.c | 93 | ||||
-rw-r--r-- | x11/e17-module-cpu/pkg-descr | 6 | ||||
-rw-r--r-- | x11/e17-module-cpu/pkg-plist | 14 |
6 files changed, 163 insertions, 0 deletions
diff --git a/x11/e17-module-cpu/Makefile b/x11/e17-module-cpu/Makefile new file mode 100644 index 000000000000..187f09dc5588 --- /dev/null +++ b/x11/e17-module-cpu/Makefile @@ -0,0 +1,36 @@ +# New ports collection makefile for: e17-module-cpu +# Date created: 23 June 2006 +# Whom: Stanislav Sedov <ssedov@mbsd.msk.ru> +# +# $FreeBSD$ +# + +PORTNAME= cpu +PORTVERSION= 20060707 +CATEGORIES= x11 +MASTER_SITES= http://mbsd.msk.ru/dist/ +PKGNAMEPREFIX= e17-module- +DISTNAME= ${PORTNAME}-${PORTVERSION} + +MAINTAINER= ssedov@mbsd.msk.ru +COMMENT= An e17 module which allows users to monitor cpu load + +BUILD_DEPENDS= enlightenment:${PORTSDIR}/x11-wm/enlightenment-devel +RUN_DEPENDS= ${BUILD_DEPENDS} + +USE_BZIP2= yes +USE_X_PREFIX= yes +USE_GMAKE= yes +GNU_CONFIGURE= yes +CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include -I${X11BASE}/include" \ + LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib" + +.if !defined(WITHOUT_NLS) +USE_GETTEXT= yes +PLIST_SUB+= NLS="" +.else +CONFIGURE_ARGS= --disable-nls +PLIST_SUB+= NLS="@comment " +.endif + +.include <bsd.port.mk> diff --git a/x11/e17-module-cpu/distinfo b/x11/e17-module-cpu/distinfo new file mode 100644 index 000000000000..5b0ebc87a26d --- /dev/null +++ b/x11/e17-module-cpu/distinfo @@ -0,0 +1,3 @@ +MD5 (cpu-20060707.tar.bz2) = c4f763fc3cf8bcac6da1fb90a54c60ac +SHA256 (cpu-20060707.tar.bz2) = 8b81a3acae9a48613ef4d10ef0f037687e084f572f4f1c7e023739fd7d4acac7 +SIZE (cpu-20060707.tar.bz2) = 298803 diff --git a/x11/e17-module-cpu/files/patch-configure b/x11/e17-module-cpu/files/patch-configure new file mode 100644 index 000000000000..bc913371e95e --- /dev/null +++ b/x11/e17-module-cpu/files/patch-configure @@ -0,0 +1,11 @@ +--- configure.orig Fri Jun 23 16:14:40 2006 ++++ configure Fri Jun 23 16:14:53 2006 +@@ -21497,7 +21497,7 @@ + + + +-MODULE_ARCH="$host_os-$host_cpu" ++MODULE_ARCH="" + + + cat >>confdefs.h <<_ACEOF diff --git a/x11/e17-module-cpu/files/patch-e_mod_main.c b/x11/e17-module-cpu/files/patch-e_mod_main.c new file mode 100644 index 000000000000..79b3a8ba3412 --- /dev/null +++ b/x11/e17-module-cpu/files/patch-e_mod_main.c @@ -0,0 +1,93 @@ +--- e_mod_main.c.orig Sun Jul 9 14:15:46 2006 ++++ e_mod_main.c Sun Jul 9 15:58:09 2006 +@@ -3,6 +3,12 @@ + #include "e_mod_config.h" + #include "config.h" + ++#if defined(__FreeBSD__) ++# include <sys/types.h> ++# include <sys/sysctl.h> ++# include <sys/resource.h> ++#endif ++ + static Cpu *_cpu_init(E_Module *m); + static void _cpu_shutdown(Cpu *n); + static void _cpu_config_menu_new(Cpu *n); +@@ -460,31 +466,66 @@ + FILE *f; + int cpu = -1; + ++#if defined(__FreeBSD__) ++ cpu = 1; /* We can't retrive per-cpu statistics, so we'll assume UP arch*/ ++#else + if (!(f = fopen("/proc/stat", "r"))) + return -1; + + while (fscanf(f, "cp%s %*u %*u %*u %*u %*u %*u %*u %*u\n", (char *)&tmp) == 1) + cpu++; +- + fclose(f); ++#endif ++ + return cpu; + } + + static void + _cpu_face_get_load(Cpu_Face *cf) + { ++ int cpu_count; ++ Edje_Message_Float msg; ++#if defined(__FreeBSD__) ++ long cp_time[CPUSTATES]; ++ static long old_used, old_tot; ++ long new_used, new_tot; ++ size_t len; ++#else + static unsigned long old_u[4], old_n[4], old_s[4], old_i[4], old_wa[4], old_hi[4], old_si[4]; + unsigned long new_u, new_n, new_s, new_i, new_wa = 0, new_hi = 0, new_si = 0, ticks_past; + int tmp_u, tmp_n, tmp_s, tmp_i; + char dummy[16]; + FILE *stat; +- int cpu_count; +- Edje_Message_Float msg; ++#endif + + cpu_count = _cpu_face_get_cpu_count(cf); + if (cpu_count == -1) + return; + ++#if defined(__FreeBSD__) ++ len = sizeof(cp_time); ++ ++ if (sysctlbyname("kern.cp_time", &cp_time, &len, NULL, 0) < 0) { ++ warn("sysctl()"); ++ return; ++ } ++ ++ new_used = cp_time[CP_USER] + cp_time[CP_NICE] + cp_time[CP_SYS]; ++ new_tot = new_used + cp_time[CP_IDLE]; ++ ++ if (new_tot == old_tot) ++ msg.val = 0; ++ else ++ msg.val = 100 * (float)(new_used - old_used) / (float)(new_tot - old_tot); ++ ++ cpu_stats[0] = msg.val; ++ edje_object_message_send(cf->cpu_obj, EDJE_MESSAGE_FLOAT, 0, &msg); ++ ++ old_tot = new_tot; ++ old_used = new_used; ++ ++#else ++ + if (!(stat = fopen("/proc/stat", "r"))) + return; + +@@ -537,6 +578,7 @@ + i++; + } + fclose(stat); ++#endif + } + + static void diff --git a/x11/e17-module-cpu/pkg-descr b/x11/e17-module-cpu/pkg-descr new file mode 100644 index 000000000000..24b74c04f88d --- /dev/null +++ b/x11/e17-module-cpu/pkg-descr @@ -0,0 +1,6 @@ +This e17 module allows users to monitor current cpu load. It can draw +load graph and display cpu load percentage. The polling interval is +fully configurable. + +Author: Matthew Mullins +WWW: http://www.enlightenment.org diff --git a/x11/e17-module-cpu/pkg-plist b/x11/e17-module-cpu/pkg-plist new file mode 100644 index 000000000000..d87fb1dfae0b --- /dev/null +++ b/x11/e17-module-cpu/pkg-plist @@ -0,0 +1,14 @@ +lib/enlightenment/modules/cpu/cpu.edj +lib/enlightenment/modules/cpu/module.a +lib/enlightenment/modules/cpu/module.eap +lib/enlightenment/modules/cpu/module.la +lib/enlightenment/modules/cpu/module.so +lib/enlightenment/modules/cpu/module_icon.png +%%NLS%%share/locale/bg/LC_MESSAGES/cpu.mo +%%NLS%%share/locale/eo/LC_MESSAGES/cpu.mo +%%NLS%%share/locale/fi/LC_MESSAGES/cpu.mo +%%NLS%%share/locale/it/LC_MESSAGES/cpu.mo +%%NLS%%share/locale/ja/LC_MESSAGES/cpu.mo +%%NLS%%share/locale/ru/LC_MESSAGES/cpu.mo +%%NLS%%share/locale/sv/LC_MESSAGES/cpu.mo +@dirrm lib/enlightenment/modules/cpu |