mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-19 11:35:12 +00:00
Show cached memory as in free (Linux only)
This commit is contained in:
parent
5e6db91b6d
commit
0af1939caf
@ -665,6 +665,8 @@ values:
|
||||
- (interval)
|
||||
- name: free_bufcache
|
||||
desc: Amount of memory cached or buffered, as reported by free. Linux only.
|
||||
- name: free_cached
|
||||
desc: Amount of memory cached, as reported by free. Linux only.
|
||||
- name: freq
|
||||
desc: |-
|
||||
Returns CPU #n's frequency in MHz. CPUs are counted from 1.
|
||||
|
@ -532,6 +532,12 @@ void print_free_bufcache(struct text_object *obj, char *p,
|
||||
p_max_size);
|
||||
}
|
||||
|
||||
void print_free_cached(struct text_object *obj, char *p,
|
||||
unsigned int p_max_size) {
|
||||
human_readable(apply_base_multiplier(obj->data.s, info.free_cached), p,
|
||||
p_max_size);
|
||||
}
|
||||
|
||||
void print_evaluate(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||
std::vector<char> buf(text_buffer_size.get(*state));
|
||||
evaluate(obj->data.s, &buf[0], buf.size());
|
||||
|
@ -146,6 +146,7 @@ void print_threads(struct text_object *, char *, unsigned int);
|
||||
void print_buffers(struct text_object *, char *, unsigned int);
|
||||
void print_cached(struct text_object *, char *, unsigned int);
|
||||
void print_free_bufcache(struct text_object *, char *, unsigned int);
|
||||
void print_free_cached(struct text_object *, char *, unsigned int);
|
||||
|
||||
void print_evaluate(struct text_object *, char *, unsigned int);
|
||||
|
||||
|
@ -170,7 +170,7 @@ struct information {
|
||||
memmax, memdirty, shmem, legacymem, memactive, meminactive, memwired,
|
||||
memlaundry;
|
||||
unsigned long long swap, swapfree, swapmax;
|
||||
unsigned long long bufmem, buffers, cached, free_bufcache;
|
||||
unsigned long long bufmem, buffers, cached, free_bufcache, free_cached;
|
||||
|
||||
unsigned short procs;
|
||||
unsigned short run_procs;
|
||||
|
@ -1212,6 +1212,9 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||
END OBJ(free_bufcache, &update_meminfo) obj->data.s = STRNDUP_ARG;
|
||||
obj->callbacks.print = &print_free_bufcache;
|
||||
obj->callbacks.free = &gen_free_opaque;
|
||||
END OBJ(free_cached, &update_meminfo) obj->data.s = STRNDUP_ARG;
|
||||
obj->callbacks.print = &print_free_cached;
|
||||
obj->callbacks.free = &gen_free_opaque;
|
||||
#endif /* __linux__ */
|
||||
#ifdef __FreeBSD__
|
||||
END OBJ(memactive, &update_meminfo) obj->data.s = STRNDUP_ARG;
|
||||
|
@ -192,7 +192,7 @@ int update_meminfo(void) {
|
||||
info.memmax = info.memdirty = info.swap = info.swapfree = info.swapmax =
|
||||
info.memwithbuffers = info.buffers = info.cached = info.memfree =
|
||||
info.memeasyfree = info.legacymem = info.shmem = info.memavail =
|
||||
info.free_bufcache = 0;
|
||||
info.free_bufcache = info.free_cached = 0;
|
||||
|
||||
if (!(meminfo_fp = open_file("/proc/meminfo", &reported))) { return 0; }
|
||||
|
||||
@ -261,7 +261,8 @@ int update_meminfo(void) {
|
||||
info.memeasyfree = cureasyfree;
|
||||
info.legacymem =
|
||||
info.memmax - (info.memfree + info.buffers + info.cached + sreclaimable);
|
||||
info.free_bufcache = info.cached + info.buffers + sreclaimable;
|
||||
info.free_cached = info.cached + sreclaimable;
|
||||
info.free_bufcache = info.free_cached + info.buffers;
|
||||
|
||||
fclose(meminfo_fp);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user