1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-27 04:32:55 +00:00

Moved global diskio variables into info

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1170 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Kevin Lyles 2008-06-19 19:58:07 +00:00
parent 2fd832f6b0
commit 5a8b03fba7
4 changed files with 19 additions and 19 deletions

View File

@ -4668,7 +4668,7 @@ static void generate_text_internal(char *p, int p_max_size,
(obj->data.diskio->current / update_interval) * 1024LL,
p, p_max_size, "diskio");
} else {
human_readable(diskio_value * 1024LL, p, p_max_size,
human_readable(info.diskio_value * 1024LL, p, p_max_size,
"diskio");
}
}
@ -4677,7 +4677,7 @@ static void generate_text_internal(char *p, int p_max_size,
human_readable((obj->data.diskio->current_write / update_interval) * 1024LL, p, p_max_size,
"diskio_write");
} else {
human_readable(diskio_write_value * 1024LL, p, p_max_size,
human_readable(info.diskio_write_value * 1024LL, p, p_max_size,
"diskio_write");
}
}
@ -4686,7 +4686,7 @@ static void generate_text_internal(char *p, int p_max_size,
human_readable((obj->data.diskio->current_read / update_interval) * 1024LL, p, p_max_size,
"diskio_read");
} else {
human_readable(diskio_read_value * 1024LL, p, p_max_size,
human_readable(info.diskio_read_value * 1024LL, p, p_max_size,
"diskio_read");
}
}
@ -4695,7 +4695,7 @@ static void generate_text_internal(char *p, int p_max_size,
new_graph(p, obj->a, obj->b, obj->c, obj->d,
obj->data.diskio->current, obj->e, 1);
} else {
new_graph(p, obj->a, obj->b, obj->c, obj->d, diskio_value,
new_graph(p, obj->a, obj->b, obj->c, obj->d, info.diskio_value,
obj->e, 1);
}
}
@ -4705,7 +4705,7 @@ static void generate_text_internal(char *p, int p_max_size,
obj->data.diskio->current_read, obj->e, 1);
} else {
new_graph(p, obj->a, obj->b, obj->c, obj->d,
diskio_read_value, obj->e, 1);
info.diskio_read_value, obj->e, 1);
}
}
OBJ(diskiograph_write) {
@ -4714,7 +4714,7 @@ static void generate_text_internal(char *p, int p_max_size,
obj->data.diskio->current_write, obj->e, 1);
} else {
new_graph(p, obj->a, obj->b, obj->c, obj->d,
diskio_write_value, obj->e, 1);
info.diskio_write_value, obj->e, 1);
}
}
OBJ(downspeed) {
@ -6324,9 +6324,9 @@ static void generate_text(void)
update_stuff();
/* fix diskio rates to b/s (use update_interval */
diskio_read_value = diskio_read_value / update_interval;
diskio_write_value = diskio_write_value / update_interval;
diskio_value = diskio_value / update_interval;
info.diskio_read_value /= update_interval;
info.diskio_write_value /= update_interval;
info.diskio_value /= update_interval;
/* add things to the buffer */

View File

@ -129,10 +129,6 @@ struct dns_data {
char **ns_list;
};
unsigned int diskio_value;
unsigned int diskio_read_value;
unsigned int diskio_write_value;
struct fs_stat {
char path[DEFAULT_TEXT_BUFFER_SIZE];
char type[DEFAULT_TEXT_BUFFER_SIZE];
@ -330,6 +326,10 @@ struct information {
double music_player_interval;
short kflags; /* kernel settings, see enum KFLAG */
unsigned int diskio_value;
unsigned int diskio_read_value;
unsigned int diskio_write_value;
};
enum {

View File

@ -145,7 +145,7 @@ void update_diskio(void)
int tot, tot_read, tot_write;
if (!(fp = open_file("/proc/diskstats", &rep))) {
diskio_value = 0;
info.diskio_value = 0;
return;
}
@ -222,9 +222,9 @@ void update_diskio(void)
last_read = current_read;
last_write = current_write;
diskio_value = tot;
diskio_read_value = tot_read;
diskio_write_value = tot_write;
info.diskio_value = tot;
info.diskio_read_value = tot_read;
info.diskio_write_value = tot_write;
fclose(fp);
}

View File

@ -705,9 +705,9 @@ void update_diskio()
* That's why it is better to return 0 first time; */
if (diskio_setup == 0) {
diskio_setup = 1;
diskio_value = 0;
info.diskio_value = 0;
} else {
diskio_value = (unsigned int) ((diskio_current - diskio_prev) / 1024);
info.diskio_value = (unsigned int) ((diskio_current - diskio_prev) / 1024);
}
diskio_prev = diskio_current;