Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 61572 Details for
Bug 96601
torsmo-0.18-r5 patch+ebuild
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
torsmo-0.18.avgsmp.patch
torsmo-0.18.avgsmp.patch (text/plain), 5.83 KB, created by
Brenden Matthews
on 2005-06-20 05:53:58 UTC
(
hide
)
Description:
torsmo-0.18.avgsmp.patch
Filename:
MIME Type:
Creator:
Brenden Matthews
Created:
2005-06-20 05:53:58 UTC
Size:
5.83 KB
patch
obsolete
>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;i<info.net_rec_avg_samples;i++) >+ curtmp += net_rec[i]; >+ ns->recv_speed = curtmp / (double)info.net_rec_avg_samples; >+ curtmp = 0; >+ for (i=0;i<info.net_trans_avg_samples;i++) >+ curtmp += net_trans[i]; >+ ns->trans_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;i<info.cpu_avg_samples;i++) >+ curtmp += cpu_val[i]; >+ info.cpu_usage = curtmp / info.cpu_avg_samples; > last_cpu_sum = cpu_user+cpu_nice+cpu_system; >+ for (i=info.cpu_avg_samples;i>1;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; }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 96601
:
61571
| 61572