From 1d7a55a28c6d0209b1681c2d69a60182d8a90324 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 21 Jun 2005 11:01:17 +0000 Subject: another small patch for a small feature of unknown origin. bug #96601 (Portage version: 2.0.51.22-r1) --- app-admin/torsmo/ChangeLog | 9 +- app-admin/torsmo/Manifest | 13 +- app-admin/torsmo/files/digest-torsmo-0.18-r5 | 1 + app-admin/torsmo/files/torsmo-0.18.avgsmp.patch | 209 ++++++++++++++++++++++++ app-admin/torsmo/torsmo-0.18-r5.ebuild | 63 +++++++ 5 files changed, 284 insertions(+), 11 deletions(-) create mode 100644 app-admin/torsmo/files/digest-torsmo-0.18-r5 create mode 100644 app-admin/torsmo/files/torsmo-0.18.avgsmp.patch create mode 100644 app-admin/torsmo/torsmo-0.18-r5.ebuild (limited to 'app-admin/torsmo') diff --git a/app-admin/torsmo/ChangeLog b/app-admin/torsmo/ChangeLog index df8c0ed1490e..4696ad7c0c79 100644 --- a/app-admin/torsmo/ChangeLog +++ b/app-admin/torsmo/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for app-admin/torsmo # Copyright 2000-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-admin/torsmo/ChangeLog,v 1.33 2005/06/06 11:58:36 dragonheart Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-admin/torsmo/ChangeLog,v 1.34 2005/06/21 11:01:17 dragonheart Exp $ + +*torsmo-0.18-r5 (21 Jun 2005) + + 21 Jun 2005; Daniel Black + +files/torsmo-0.18.avgsmp.patch, +torsmo-0.18-r5.ebuild: + another small patch for a small feature of unknown origin. bug #96601 thanks + to Brenden Matthews *torsmo-0.18-r4 (06 Jun 2005) diff --git a/app-admin/torsmo/Manifest b/app-admin/torsmo/Manifest index ff0aee1c265c..b3ec9d2e7c61 100644 --- a/app-admin/torsmo/Manifest +++ b/app-admin/torsmo/Manifest @@ -1,21 +1,14 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - MD5 6711f1971229aeb76f130e1ea519ed69 ChangeLog 5991 MD5 e62755aeb2fcd53a4426e99d3af550ed metadata.xml 549 MD5 002239c582893089c2347704fc6ed564 torsmo-0.18-r4.ebuild 1702 MD5 b153c962309ce33f402b26076b8310a5 torsmo-0.18-r1.ebuild 1450 +MD5 683957bb6c9ce28a9142bb6e9d0f3cd9 torsmo-0.18-r5.ebuild 1704 MD5 796256d9236187ccfd18fd95f1118e84 torsmo-0.18-r3.ebuild 1657 MD5 19932267a722d71554454bb3779a9ae0 files/digest-torsmo-0.18-r1 62 MD5 0aa744033b2091d42d3817cd1bb62f59 files/torsmo-0.18.i2c.patch 5254 MD5 19932267a722d71554454bb3779a9ae0 files/digest-torsmo-0.18-r4 62 +MD5 17b31d62740e3f8202573c2b939e32d6 files/torsmo-0.18.avgsmp.patch 5971 +MD5 19932267a722d71554454bb3779a9ae0 files/digest-torsmo-0.18-r5 62 MD5 3345892556d2bc8fddf510c86d3c70f0 files/torsmo-0.18.xwin.patch 575 MD5 665c68fb6d053d92d013ba44a84f394c files/torsmo-0.18.noswap.patch 524 MD5 19932267a722d71554454bb3779a9ae0 files/digest-torsmo-0.18-r3 62 ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.1 (GNU/Linux) - -iD8DBQFCpDqEmdTrptrqvGERAku/AJwIfgK4FhbXzlW61Ag1T6N4rdUTUQCfX+3E -8Ge5qAieV+cbCgKR1u3sMZ4= -=ko5x ------END PGP SIGNATURE----- diff --git a/app-admin/torsmo/files/digest-torsmo-0.18-r5 b/app-admin/torsmo/files/digest-torsmo-0.18-r5 new file mode 100644 index 000000000000..f2c1092e434d --- /dev/null +++ b/app-admin/torsmo/files/digest-torsmo-0.18-r5 @@ -0,0 +1 @@ +MD5 88bd8f627637d785a1d681f4f15f00b6 torsmo-0.18.tar.gz 84020 diff --git a/app-admin/torsmo/files/torsmo-0.18.avgsmp.patch b/app-admin/torsmo/files/torsmo-0.18.avgsmp.patch new file mode 100644 index 000000000000..6379dd6328cb --- /dev/null +++ b/app-admin/torsmo/files/torsmo-0.18.avgsmp.patch @@ -0,0 +1,209 @@ +diff -ruN torsmo-0.18/linux.c torsmo-0.18.new/linux.c +--- torsmo-0.18/linux.c 2004-12-21 14:20:07.000000000 -0700 ++++ torsmo-0.18.new/linux.c 2005-06-20 05:46:40.000000000 -0600 +@@ -115,7 +115,11 @@ + + void update_net_stats() { + static int rep; ++ // FIXME: arbitrary size chosen to keep code simple. ++ static float net_rec[15]; ++ static float net_trans[15]; + unsigned int i; ++ unsigned int curtmp; + char buf[256]; + double delta; + +@@ -174,9 +178,31 @@ + ns->trans += (t - ns->last_read_trans); + ns->last_read_trans = t; + ++ ++ + /* calculate speeds */ +- ns->recv_speed = (ns->recv - last_recv) / delta; +- ns->trans_speed = (ns->trans - last_trans) / delta; ++ net_rec[0] = (ns->recv - last_recv) / delta; ++ net_trans[0] = (ns->trans - last_trans) / delta; ++ curtmp = 0; ++ // get an average ++ for (i=0;irecv_speed = curtmp / (double)info.net_rec_avg_samples; ++ curtmp = 0; ++ for (i=0;itrans_speed = curtmp / (double)info.net_trans_avg_samples; ++ if (info.net_rec_avg_samples > 1) { ++ for (i=info.net_rec_avg_samples;i>1;i--) ++ net_rec[i-1] = net_rec[i-2]; ++ } ++ if (info.net_trans_avg_samples > 1) { ++ for (i=info.net_trans_avg_samples;i>1;i--) ++ net_trans[i-1] = net_trans[i-2]; ++ } ++ //printf("net %i %i\n", info.net_trans_avg_samples, info.net_rec_avg_samples); ++ ++ + } + + /* fclose(net_dev_fp); net_dev_fp = NULL; */ +@@ -193,8 +219,12 @@ + static FILE *stat_fp; + + static void update_stat() { ++ // FIXME: arbitrary size? ++ static double cpu_val[15]; + static int rep; + char buf[256]; ++ int i; ++ double curtmp; + + if (stat_fp == NULL) + stat_fp = open_file("/proc/stat", &rep); +@@ -228,10 +258,16 @@ + + if (clock_ticks == 0) + clock_ticks = sysconf(_SC_CLK_TCK); +- +- info.cpu_usage = (cpu_user+cpu_nice+cpu_system - last_cpu_sum) / delta +- / (double) clock_ticks / info.cpu_count; ++ curtmp = 0; ++ cpu_val[0] = (cpu_user+cpu_nice+cpu_system-last_cpu_sum) / delta / (double) clock_ticks / info.cpu_count; ++ for (i=0;i1;i--) ++ cpu_val[i-1] = cpu_val[i-2]; ++ //printf("cpu %i\n", info.cpu_avg_samples); ++ + } + } + +diff -ruN torsmo-0.18/torsmo.c torsmo-0.18.new/torsmo.c +--- torsmo-0.18/torsmo.c 2004-12-21 15:14:46.000000000 -0700 ++++ torsmo-0.18.new/torsmo.c 2005-06-20 05:46:42.000000000 -0600 +@@ -61,6 +61,8 @@ + + static long default_fg_color, default_bg_color, default_out_color; + ++static int cpu_avg_samples, net_rec_avg_samples, net_trans_avg_samples; ++ + #ifdef OWN_WINDOW + /* create own window or draw stuff to root? */ + static int own_window; +@@ -1841,6 +1843,9 @@ + fork_to_background = 0; + border_margin = 3; + border_width = 1; ++ info.cpu_avg_samples = 4; ++ info.net_rec_avg_samples = 4; ++ info.net_trans_avg_samples = 4; + default_fg_color = WhitePixel(display, screen); + default_bg_color = BlackPixel(display, screen); + default_out_color = BlackPixel(display, screen); +@@ -1975,6 +1980,46 @@ + else + CONF_ERR + } ++ CONF("cpu_avg_samples") { ++ if(value) { ++ cpu_avg_samples = strtol(value, 0, 0); ++ if (cpu_avg_samples < 1 || cpu_avg_samples > 14) ++ CONF_ERR ++ else ++ info.cpu_avg_samples = cpu_avg_samples; ++ } ++ else ++ CONF_ERR ++ } ++ CONF("net_rec_avg_samples") { ++ if(value) { ++ net_rec_avg_samples = strtol(value, 0, 0); ++ if (net_rec_avg_samples < 1 || net_rec_avg_samples > 14) { ++ CONF_ERR ++ } ++ else ++ info.net_rec_avg_samples = net_rec_avg_samples; ++ } ++ else ++ CONF_ERR ++ } ++ CONF("net_trans_avg_samples") { ++ if(value) { ++ net_trans_avg_samples = strtol(value, 0, 0); ++ if (net_trans_avg_samples < 1 || net_trans_avg_samples > 14) ++ CONF_ERR ++ else ++ info.net_trans_avg_samples = net_trans_avg_samples; ++ } ++ else ++ CONF_ERR ++ } ++ ++ ++ ++ ++ ++ + #ifdef XDBE + CONF("double_buffer") { + use_xdbe = string_to_bool(value); +diff -ruN torsmo-0.18/torsmo.h torsmo-0.18.new/torsmo.h +--- torsmo-0.18/torsmo.h 2004-12-21 14:49:17.000000000 -0700 ++++ torsmo-0.18.new/torsmo.h 2005-06-20 05:47:29.000000000 -0600 +@@ -30,6 +30,7 @@ + + struct cpu_stat { + unsigned int user, nice, system, idle, iowait, irq, softirq; ++ int cpu_avg_samples; + }; + + enum { +@@ -71,6 +72,9 @@ + float cpu_usage; + struct cpu_stat cpu_summed; + unsigned int cpu_count; ++ unsigned int cpu_avg_samples; ++ ++ unsigned int net_rec_avg_samples, net_trans_avg_samples; + + float loadavg[3]; + +diff -ruN torsmo-0.18/torsmorc.sample torsmo-0.18.new/torsmorc.sample +--- torsmo-0.18/torsmorc.sample 2004-12-21 14:56:12.000000000 -0700 ++++ torsmo-0.18.new/torsmorc.sample 2005-06-20 05:50:09.000000000 -0600 +@@ -75,6 +75,14 @@ + # set to yes if you want all text to be in uppercase + uppercase no + ++# number of cpu samples to average ++cpu_avg_samples 4 ++ ++# number of net samples to average ++net_rec_avg_samples 4 # receiving ++net_trans_avg_samples # transmitting ++ ++ + # boinc (seti) dir + # seti_dir /opt/seti + +diff -ruN torsmo-0.18/x11.c torsmo-0.18.new/x11.c +--- torsmo-0.18/x11.c 2004-12-21 15:19:55.000000000 -0700 ++++ torsmo-0.18.new/x11.c 2005-06-20 04:47:00.000000000 -0600 +@@ -64,15 +64,6 @@ + + XFree(buf); buf = 0; + +- /* get workarea */ +- if (XGetWindowProperty(display, root, ATOM(_NET_WORKAREA), desktop*4, 4, +- False, XA_CARDINAL, &type, &format, &nitems, &bytes, &buf) == +- Success && type == XA_CARDINAL) { +- workarea[0] = ((long *) buf)[0]; +- workarea[1] = ((long *) buf)[1]; +- workarea[2] = ((long *) buf)[2]; +- workarea[3] = ((long *) buf)[3]; +- } + } + + if (buf) { XFree(buf); buf = 0; } diff --git a/app-admin/torsmo/torsmo-0.18-r5.ebuild b/app-admin/torsmo/torsmo-0.18-r5.ebuild new file mode 100644 index 000000000000..610aec3b6c84 --- /dev/null +++ b/app-admin/torsmo/torsmo-0.18-r5.ebuild @@ -0,0 +1,63 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/torsmo/torsmo-0.18-r5.ebuild,v 1.1 2005/06/21 11:01:17 dragonheart Exp $ + +inherit eutils + +DESCRIPTION="minimalist system monitor for X" +HOMEPAGE="http://torsmo.sourceforge.net/" +SRC_URI="mirror://sourceforge/torsmo/${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~sparc ~x86" +IUSE="truetype seti" + +RDEPEND="virtual/libc + virtual/x11 + truetype? ( >=media-libs/freetype-2 ) + seti? ( sci-astronomy/setiathome )" + +DEPEND="truetype? ( >=media-libs/freetype-2 ) + virtual/x11 + >=sys-devel/automake-1.4 + sys-devel/autoconf + sys-apps/grep + sys-apps/sed + sys-devel/gcc" + +src_unpack() { + unpack ${A} + cd ${S} + epatch ${FILESDIR}/${P}.noswap.patch + epatch ${FILESDIR}/${P}.i2c.patch + epatch ${FILESDIR}/${P}.avgsmp.patch +} + +src_compile() { + econf \ + `use_enable truetype xft` \ + `use_enable seti` \ + --x-libraries=/usr/X11R6/lib/ || die "econf failed" + emake || die "compile failed" +} + +src_install() { + emake DESTDIR=${D} install || die "make install failed" + dodoc ChangeLog AUTHORS README torsmorc.sample +} + +pkg_postinst() { + einfo 'default configuration file is "~/.torsmorc"' + einfo "you can find a sample configuration file in" + einfo "/usr/share/doc/${PF}/torsmorc.sample.gz" + einfo + einfo "Comment out temperature info lines if you have no kernel" + einfo "support for it." + einfo + ewarn "Torsmo doesn't work with window managers that" + ewarn "take control over root window such as Gnome's nautilus." + einfo + ewarn "Please note that >=0.18 contains mozilla support without" + ewarn "patching, thus the mozilla USE flag has been dropped" +} -- cgit v1.2.3-65-gdbad