1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-30 14:09:13 +00:00

convert buffers and cached to callbacks.print

This commit is contained in:
Phil Sutter 2009-11-26 01:10:19 +01:00
parent 1f8bafbcfc
commit 871c4b2d02
4 changed files with 17 additions and 6 deletions

View File

@ -589,3 +589,15 @@ void print_threads(struct text_object *obj, char *p, int p_max_size)
(void)obj;
spaced_print(p, p_max_size, "%hu", 4, info.threads);
}
void print_buffers(struct text_object *obj, char *p, int p_max_size)
{
(void)obj;
human_readable(info.buffers * 1024, p, p_max_size);
}
void print_cached(struct text_object *obj, char *p, int p_max_size)
{
(void)obj;
human_readable(info.cached * 1024, p, p_max_size);
}

View File

@ -99,4 +99,7 @@ void print_running_processes(struct text_object *, char *, int);
void print_running_threads(struct text_object *, char *, int);
void print_threads(struct text_object *, char *, int);
void print_buffers(struct text_object *, char *, int);
void print_cached(struct text_object *, char *, int);
#endif /* _COMMON_H */

View File

@ -865,12 +865,6 @@ void generate_text_internal(char *p, int p_max_size,
}
#endif /* __OpenBSD__ */
OBJ(buffers) {
human_readable(cur->buffers * 1024, p, 255);
}
OBJ(cached) {
human_readable(cur->cached * 1024, p, 255);
}
OBJ(cmdline_to_pid) {
print_cmdline_to_pid(obj, p, p_max_size);
}

View File

@ -377,7 +377,9 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
obj->callbacks.print = &get_obsd_product;
#endif /* __OpenBSD__ */
END OBJ(buffers, &update_meminfo)
obj->callbacks.print = &print_buffers;
END OBJ(cached, &update_meminfo)
obj->callbacks.print = &print_cached;
#define SCAN_CPU(__arg, __var) { \
int __offset = 0; \
if (__arg && sscanf(__arg, " cpu%d %n", &__var, &__offset) > 0) \