mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 11:05:18 +00:00
convert buffers and cached to callbacks.print
This commit is contained in:
parent
1f8bafbcfc
commit
871c4b2d02
12
src/common.c
12
src/common.c
@ -589,3 +589,15 @@ void print_threads(struct text_object *obj, char *p, int p_max_size)
|
|||||||
(void)obj;
|
(void)obj;
|
||||||
spaced_print(p, p_max_size, "%hu", 4, info.threads);
|
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);
|
||||||
|
}
|
||||||
|
@ -99,4 +99,7 @@ void print_running_processes(struct text_object *, char *, int);
|
|||||||
void print_running_threads(struct text_object *, char *, int);
|
void print_running_threads(struct text_object *, char *, int);
|
||||||
void print_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 */
|
#endif /* _COMMON_H */
|
||||||
|
@ -865,12 +865,6 @@ void generate_text_internal(char *p, int p_max_size,
|
|||||||
}
|
}
|
||||||
#endif /* __OpenBSD__ */
|
#endif /* __OpenBSD__ */
|
||||||
|
|
||||||
OBJ(buffers) {
|
|
||||||
human_readable(cur->buffers * 1024, p, 255);
|
|
||||||
}
|
|
||||||
OBJ(cached) {
|
|
||||||
human_readable(cur->cached * 1024, p, 255);
|
|
||||||
}
|
|
||||||
OBJ(cmdline_to_pid) {
|
OBJ(cmdline_to_pid) {
|
||||||
print_cmdline_to_pid(obj, p, p_max_size);
|
print_cmdline_to_pid(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,9 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
obj->callbacks.print = &get_obsd_product;
|
obj->callbacks.print = &get_obsd_product;
|
||||||
#endif /* __OpenBSD__ */
|
#endif /* __OpenBSD__ */
|
||||||
END OBJ(buffers, &update_meminfo)
|
END OBJ(buffers, &update_meminfo)
|
||||||
|
obj->callbacks.print = &print_buffers;
|
||||||
END OBJ(cached, &update_meminfo)
|
END OBJ(cached, &update_meminfo)
|
||||||
|
obj->callbacks.print = &print_cached;
|
||||||
#define SCAN_CPU(__arg, __var) { \
|
#define SCAN_CPU(__arg, __var) { \
|
||||||
int __offset = 0; \
|
int __offset = 0; \
|
||||||
if (__arg && sscanf(__arg, " cpu%d %n", &__var, &__offset) > 0) \
|
if (__arg && sscanf(__arg, " cpu%d %n", &__var, &__offset) > 0) \
|
||||||
|
Loading…
Reference in New Issue
Block a user