mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-02-12 08:58:28 +00:00
Added diskio_avg_samples patch (thanks Yeon-Hyeong)
This commit is contained in:
parent
814469b0c9
commit
68ea7a7859
@ -1,3 +1,6 @@
|
||||
2009-05-01
|
||||
* Added diskio_avg_samples patch (thanks Yeon-Hyeong)
|
||||
|
||||
2009-05-01
|
||||
* Conky 1.7.0 "Hungry Hobo" released!
|
||||
|
||||
|
53
README
53
README
@ -173,15 +173,15 @@ conky(1) conky(1)
|
||||
|
||||
[1mbackground[0m
|
||||
Boolean value, if true, Conky will be forked to background when
|
||||
started
|
||||
started.
|
||||
|
||||
|
||||
[1mborder_margin[0m
|
||||
Border margin in pixels
|
||||
Border margin in pixels.
|
||||
|
||||
|
||||
[1mborder_width[0m
|
||||
Border width in pixels
|
||||
Border width in pixels.
|
||||
|
||||
|
||||
[1mcolorN [22mPredefine a color for use inside TEXT segments. Substitute N by
|
||||
@ -190,7 +190,11 @@ conky(1) conky(1)
|
||||
|
||||
|
||||
[1mcpu_avg_samples[0m
|
||||
The number of samples to average for CPU monitoring
|
||||
The number of samples to average for CPU monitoring.
|
||||
|
||||
|
||||
[1mdiskio_avg_samples[0m
|
||||
The number of samples to average for disk I/O monitoring.
|
||||
|
||||
|
||||
[1mtop_cpu_separate[0m
|
||||
@ -202,7 +206,7 @@ conky(1) conky(1)
|
||||
[1mdefault_bar_size[0m
|
||||
Specify a default width and height for bars. Example: 'de‐
|
||||
fault_bar_size 0 6'. This is particularly useful for execbar and
|
||||
execibar as they do not take size arguments
|
||||
execibar as they do not take size arguments.
|
||||
|
||||
|
||||
[1mdefault_graph_size[0m
|
||||
@ -672,14 +676,19 @@ conky(1) conky(1)
|
||||
a digit between 0 and 9, inclusively.
|
||||
|
||||
|
||||
[1mcombine var1 var2[0m
|
||||
Places the lines of var2 to the right of the lines of var1
|
||||
seperated by the chars that are put between var1 and var2. For
|
||||
example: ${combine ${head /proc/cpuinfo 2} - ${head /proc/memin‐
|
||||
fo 1}} gives as output "cpuinfo_line1 - meminfo_line1" on line 1
|
||||
and "cpuinfo_line2 -" on line 2. $combine vars can also be nest‐
|
||||
ed to place more vars next to each other.
|
||||
|
||||
|
||||
[1mconky_version[0m
|
||||
Conky version
|
||||
|
||||
|
||||
[1mcombine var1 var2[0m
|
||||
Places the lines of var2 to the right of the lines of var1 seperated by the chars that are put between var1 and var2. For example: ${combine ${head /proc/cpuinfo 2} - ${head /proc/meminfo 1}} gives as output "cpuinfo_line1 - meminfo_line1" on line 1 and "cpuinfo_line2 -" on line 2. $combine vars can also be nested to place more vars next to each other.
|
||||
|
||||
|
||||
[1mconky_build_date[0m
|
||||
Date Conky was built
|
||||
|
||||
@ -874,21 +883,6 @@ conky(1) conky(1)
|
||||
omitted, the parameter defaults to 1.
|
||||
|
||||
|
||||
<<<<<<< HEAD:README
|
||||
[1mfreq_dyn (n)[0m
|
||||
Returns CPU #n's frequency in MHz (defaults to 1), but is calcu‐
|
||||
lated by counting to clock cycles to complete an instruction.
|
||||
Only available for x86/amd64.
|
||||
|
||||
|
||||
[1mfreq_dyn_g (n)[0m
|
||||
Returns CPU #n's frequency in GHz (defaults to 1), but is calcu‐
|
||||
lated by counting to clock cycles to complete an instruction.
|
||||
Only available for x86/amd64.
|
||||
|
||||
|
||||
=======
|
||||
>>>>>>> cb4b914... Few misc doc related things.:README
|
||||
[1mfs_bar (height),(width) fs[0m
|
||||
Bar that shows how much space is used on a file system. height
|
||||
is the height in pixels. fs is any file on that file system.
|
||||
@ -1262,15 +1256,11 @@ conky(1) conky(1)
|
||||
Bar that shows amount of memory in use
|
||||
|
||||
|
||||
<<<<<<< HEAD:README
|
||||
[1mmemgauge (height),(width)[0m
|
||||
Gauge that shows amount of memory in use (see cpugauge)
|
||||
|
||||
|
||||
[1mmemgraph ("normal"|"log") (height),(width) (gradient colour 1) (gradi‐[0m
|
||||
=======
|
||||
[1mmemgraph ("normal"|"log") (height),(width) (gradient colour 1) (gradi‐[0m
|
||||
>>>>>>> cb4b914... Few misc doc related things.:README
|
||||
[1ment colour 2) (scale)[0m
|
||||
Memory usage graph. Uses a logarithmic scale (to see small num‐
|
||||
bers) when you use "log" instead of "normal".
|
||||
@ -1664,18 +1654,11 @@ conky(1) conky(1)
|
||||
Move text over by N pixels. See also $voffset.
|
||||
|
||||
|
||||
<<<<<<< HEAD:README
|
||||
[1mrss url delay_in_minutes action (num_par (spaces_in_front))[0m
|
||||
Download and parse RSS feeds. Action may be one of the follow‐
|
||||
ing: feed_title, item_title (with num par), item_desc (with num
|
||||
par) and item_titles (when using this action and spaces_in_front
|
||||
is given conky places that many spaces in front of each item).
|
||||
=======
|
||||
[1mrss url delay_in_minutes action item_num[0m
|
||||
Download and parse RSS feeds. Action may be one of the follow‐
|
||||
ing: feed_title, item_title (with num par), item_desc (with num
|
||||
par) and item_titles.
|
||||
>>>>>>> cb4b914... Few misc doc related things.:README
|
||||
|
||||
|
||||
[1mtab (width, (start))[0m
|
||||
|
@ -16,21 +16,21 @@
|
||||
<varlistentry>
|
||||
<term><command><option>background</option></command></term>
|
||||
<listitem>
|
||||
Boolean value, if true, Conky will be forked to background when started
|
||||
Boolean value, if true, Conky will be forked to background when started.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>border_margin</option></command></term>
|
||||
<listitem>
|
||||
Border margin in pixels
|
||||
Border margin in pixels.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>border_width</option></command></term>
|
||||
<listitem>
|
||||
Border width in pixels
|
||||
Border width in pixels.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -44,7 +44,14 @@
|
||||
<varlistentry>
|
||||
<term><command><option>cpu_avg_samples</option></command></term>
|
||||
<listitem>
|
||||
The number of samples to average for CPU monitoring
|
||||
The number of samples to average for CPU monitoring.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>diskio_avg_samples</option></command></term>
|
||||
<listitem>
|
||||
The number of samples to average for disk I/O monitoring.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -58,7 +65,7 @@
|
||||
<varlistentry>
|
||||
<term><command><option>default_bar_size</option></command></term>
|
||||
<listitem>
|
||||
Specify a default width and height for bars. Example: 'default_bar_size 0 6'. This is particularly useful for execbar and execibar as they do not take size arguments
|
||||
Specify a default width and height for bars. Example: 'default_bar_size 0 6'. This is particularly useful for execbar and execibar as they do not take size arguments.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
14
doc/conky.1
14
doc/conky.1
@ -155,15 +155,15 @@ Aligned position on screen, may be top_left, top_right, top_middle, bottom_left,
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBbackground\fR\*(T>\fR
|
||||
Boolean value, if true, Conky will be forked to background when started
|
||||
Boolean value, if true, Conky will be forked to background when started.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBborder_margin\fR\*(T>\fR
|
||||
Border margin in pixels
|
||||
Border margin in pixels.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBborder_width\fR\*(T>\fR
|
||||
Border width in pixels
|
||||
Border width in pixels.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBcolorN\fR\*(T>\fR
|
||||
@ -171,7 +171,11 @@ Predefine a color for use inside TEXT segments. Substitute N by a digit between
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBcpu_avg_samples\fR\*(T>\fR
|
||||
The number of samples to average for CPU monitoring
|
||||
The number of samples to average for CPU monitoring.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBdiskio_avg_samples\fR\*(T>\fR
|
||||
The number of samples to average for disk I/O monitoring.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBtop_cpu_separate\fR\*(T>\fR
|
||||
@ -179,7 +183,7 @@ If true, cpu in top will show usage of one processor's power. If false, cpu in t
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBdefault_bar_size\fR\*(T>\fR
|
||||
Specify a default width and height for bars. Example: 'default_bar_size 0 6'. This is particularly useful for execbar and execibar as they do not take size arguments
|
||||
Specify a default width and height for bars. Example: 'default_bar_size 0 6'. This is particularly useful for execbar and execibar as they do not take size arguments.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBdefault_graph_size\fR\*(T>\fR
|
||||
|
15
src/conky.c
15
src/conky.c
@ -262,7 +262,7 @@ static unsigned long total_run_times;
|
||||
/* fork? */
|
||||
static int fork_to_background;
|
||||
|
||||
static int cpu_avg_samples, net_avg_samples;
|
||||
static int cpu_avg_samples, net_avg_samples, diskio_avg_samples;
|
||||
|
||||
/* filenames for output */
|
||||
char *overwrite_file = NULL; FILE *overwrite_fpointer = NULL;
|
||||
@ -6534,6 +6534,7 @@ static void set_default_configurations(void)
|
||||
total_run_times = 0;
|
||||
info.cpu_avg_samples = 2;
|
||||
info.net_avg_samples = 2;
|
||||
info.diskio_avg_samples = 2;
|
||||
info.memmax = 0;
|
||||
top_cpu = 0;
|
||||
cpu_separate = 0;
|
||||
@ -6934,6 +6935,18 @@ static void load_config_file(const char *f)
|
||||
CONF_ERR;
|
||||
}
|
||||
}
|
||||
CONF("diskio_avg_samples") {
|
||||
if (value) {
|
||||
diskio_avg_samples = strtol(value, 0, 0);
|
||||
if (diskio_avg_samples < 1 || diskio_avg_samples > 14) {
|
||||
CONF_ERR;
|
||||
} else {
|
||||
info.diskio_avg_samples = diskio_avg_samples;
|
||||
}
|
||||
} else {
|
||||
CONF_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_XDBE
|
||||
CONF("double_buffer") {
|
||||
|
@ -229,6 +229,8 @@ struct information {
|
||||
|
||||
unsigned int net_avg_samples;
|
||||
|
||||
unsigned int diskio_avg_samples;
|
||||
|
||||
float loadavg[3];
|
||||
|
||||
struct mail_s *mail;
|
||||
|
40
src/diskio.c
40
src/diskio.c
@ -52,6 +52,9 @@
|
||||
* also containing the totals. */
|
||||
static struct diskio_stat stats = {
|
||||
.next = NULL,
|
||||
.sample = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
.sample_read = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
.sample_write = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
.current = 0,
|
||||
.current_read = 0,
|
||||
.current_write = 0,
|
||||
@ -98,19 +101,40 @@ struct diskio_stat *prepare_diskio_stat(const char *s)
|
||||
static void update_diskio_values(struct diskio_stat *ds,
|
||||
unsigned int reads, unsigned int writes)
|
||||
{
|
||||
int i;
|
||||
double sum=0, sum_r=0, sum_w=0;
|
||||
|
||||
if (reads < ds->last_read || writes < ds->last_write) {
|
||||
/* counter overflow or reset - rebase to sane values */
|
||||
ds->last = 0;
|
||||
ds->last_read = 0;
|
||||
ds->last_write = 0;
|
||||
ds->last = reads+writes;
|
||||
ds->last_read = reads;
|
||||
ds->last_write = writes;
|
||||
}
|
||||
/* since the values in /proc/diskstats are absolute, we have to substract
|
||||
* our last reading. The numbers stand for "sectors read", and we therefore
|
||||
* have to divide by two to get KB */
|
||||
ds->current_read = (reads - ds->last_read) / 2;
|
||||
ds->current_write = (writes - ds->last_write) / 2;
|
||||
ds->current = ds->current_read + ds->current_write;
|
||||
ds->sample_read[0] = (reads - ds->last_read) / 2;
|
||||
ds->sample_write[0] = (writes - ds->last_write) / 2;
|
||||
ds->sample[0] = ds->sample_read[0] + ds->sample_write[0];
|
||||
|
||||
/* compute averages */
|
||||
for (i = 0; i < (signed) info.diskio_avg_samples; i++) {
|
||||
sum += ds->sample[i];
|
||||
sum_r += ds->sample_read[i];
|
||||
sum_w += ds->sample_write[i];
|
||||
}
|
||||
ds->current = sum / (double) info.diskio_avg_samples;
|
||||
ds->current_read = sum_r / (double) info.diskio_avg_samples;
|
||||
ds->current_write = sum_w / (double) info.diskio_avg_samples;
|
||||
|
||||
/* shift sample history */
|
||||
for (i = info.diskio_avg_samples-1; i > 0; i--) {
|
||||
ds->sample[i] = ds->sample[i-1];
|
||||
ds->sample_read[i] = ds->sample_read[i-1];
|
||||
ds->sample_write[i] = ds->sample_write[i-1];
|
||||
}
|
||||
|
||||
/* save last */
|
||||
ds->last_read = reads;
|
||||
ds->last_write = writes;
|
||||
ds->last = ds->last_read + ds->last_write;
|
||||
@ -125,7 +149,7 @@ void update_diskio(void)
|
||||
char buf[512], devbuf[64];
|
||||
unsigned int major, minor;
|
||||
unsigned int reads, writes;
|
||||
unsigned int total_reads, total_writes;
|
||||
unsigned int total_reads=0, total_writes=0;
|
||||
int col_count = 0;
|
||||
|
||||
stats.current = 0;
|
||||
@ -146,7 +170,7 @@ void update_diskio(void)
|
||||
*
|
||||
* XXX: ignore devices which are part of a SW RAID (MD_MAJOR) */
|
||||
if (col_count == 5 && major != LVM_BLK_MAJOR && major != NBD_MAJOR
|
||||
&& major != RAMDISK_MAJOR && major != LOOP_MAJOR) {
|
||||
&& major != RAMDISK_MAJOR && major != LOOP_MAJOR && minor==0) {
|
||||
total_reads += reads;
|
||||
total_writes += writes;
|
||||
} else {
|
||||
|
15
src/diskio.h
15
src/diskio.h
@ -32,12 +32,15 @@
|
||||
struct diskio_stat {
|
||||
struct diskio_stat *next;
|
||||
char *dev;
|
||||
unsigned int current;
|
||||
unsigned int current_read;
|
||||
unsigned int current_write;
|
||||
unsigned int last;
|
||||
unsigned int last_read;
|
||||
unsigned int last_write;
|
||||
double sample[15];
|
||||
double sample_read[15];
|
||||
double sample_write[15];
|
||||
double current;
|
||||
double current_read;
|
||||
double current_write;
|
||||
double last;
|
||||
double last_read;
|
||||
double last_write;
|
||||
};
|
||||
|
||||
struct diskio_stat *prepare_diskio_stat(const char *s);
|
||||
|
Loading…
x
Reference in New Issue
Block a user