mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-26 12:27:52 +00:00
merge diskiographs to callbacks.graphval
This commit is contained in:
parent
9581914f7d
commit
fe05542318
@ -421,13 +421,13 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
#ifdef X11
|
#ifdef X11
|
||||||
END OBJ(diskiograph, &update_diskio)
|
END OBJ(diskiograph, &update_diskio)
|
||||||
parse_diskiograph_arg(obj, arg);
|
parse_diskiograph_arg(obj, arg);
|
||||||
obj->callbacks.print = &print_diskiograph;
|
obj->callbacks.graphval = &diskiographval;
|
||||||
END OBJ(diskiograph_read, &update_diskio)
|
END OBJ(diskiograph_read, &update_diskio)
|
||||||
parse_diskiograph_arg(obj, arg);
|
parse_diskiograph_arg(obj, arg);
|
||||||
obj->callbacks.print = &print_diskiograph_read;
|
obj->callbacks.graphval = &diskiographval_read;
|
||||||
END OBJ(diskiograph_write, &update_diskio)
|
END OBJ(diskiograph_write, &update_diskio)
|
||||||
parse_diskiograph_arg(obj, arg);
|
parse_diskiograph_arg(obj, arg);
|
||||||
obj->callbacks.print = &print_diskiograph_write;
|
obj->callbacks.graphval = &diskiographval_write;
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
END OBJ(color, 0)
|
END OBJ(color, 0)
|
||||||
#ifdef X11
|
#ifdef X11
|
||||||
|
35
src/diskio.c
35
src/diskio.c
@ -165,40 +165,27 @@ void parse_diskiograph_arg(struct text_object *obj, const char *arg)
|
|||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_diskiograph_dir(struct text_object *obj, int dir, char *p, int p_max_size)
|
/* XXX: what about max values? */
|
||||||
|
|
||||||
|
uint8_t diskiographval(struct text_object *obj)
|
||||||
{
|
{
|
||||||
struct diskio_stat *diskio = obj->data.opaque;
|
struct diskio_stat *diskio = obj->data.opaque;
|
||||||
double val;
|
|
||||||
|
|
||||||
if (!diskio)
|
return (diskio ? round_to_int(diskio->current) : 0);
|
||||||
return;
|
|
||||||
|
|
||||||
if (!p_max_size)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (dir < 0)
|
|
||||||
val = diskio->current_read;
|
|
||||||
else if (dir == 0)
|
|
||||||
val = diskio->current;
|
|
||||||
else
|
|
||||||
val = diskio->current_write;
|
|
||||||
|
|
||||||
new_graph(obj, p, p_max_size, val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_diskiograph(struct text_object *obj, char *p, int p_max_size)
|
uint8_t diskiographval_read(struct text_object *obj)
|
||||||
{
|
{
|
||||||
print_diskiograph_dir(obj, 0, p, p_max_size);
|
struct diskio_stat *diskio = obj->data.opaque;
|
||||||
|
|
||||||
|
return (diskio ? round_to_int(diskio->current_read) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_diskiograph_read(struct text_object *obj, char *p, int p_max_size)
|
uint8_t diskiographval_write(struct text_object *obj)
|
||||||
{
|
{
|
||||||
print_diskiograph_dir(obj, -1, p, p_max_size);
|
struct diskio_stat *diskio = obj->data.opaque;
|
||||||
}
|
|
||||||
|
|
||||||
void print_diskiograph_write(struct text_object *obj, char *p, int p_max_size)
|
return (diskio ? round_to_int(diskio->current_write) : 0);
|
||||||
{
|
|
||||||
print_diskiograph_dir(obj, 1, p, p_max_size);
|
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
|
|
||||||
|
@ -57,9 +57,9 @@ void print_diskio_read(struct text_object *, char *, int);
|
|||||||
void print_diskio_write(struct text_object *, char *, int);
|
void print_diskio_write(struct text_object *, char *, int);
|
||||||
#ifdef X11
|
#ifdef X11
|
||||||
void parse_diskiograph_arg(struct text_object *, const char *);
|
void parse_diskiograph_arg(struct text_object *, const char *);
|
||||||
void print_diskiograph(struct text_object *, char *, int);
|
uint8_t diskiographval(struct text_object *);
|
||||||
void print_diskiograph_read(struct text_object *, char *, int);
|
uint8_t diskiographval_read(struct text_object *);
|
||||||
void print_diskiograph_write(struct text_object *, char *, int);
|
uint8_t diskiographval_write(struct text_object *);
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
|
|
||||||
#endif /* DISKIO_H_ */
|
#endif /* DISKIO_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user