1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 04:06:03 +00:00

FreeBSD: Additional memory reporting variables.

This commit is contained in:
Gene Carlson 2022-12-24 15:18:44 +09:00 committed by Brenden Matthews
parent 1524755968
commit 14bae13f81
7 changed files with 63 additions and 4 deletions

View File

@ -175,6 +175,11 @@ J
Some cleaning and commenting apparently :)
SIGHUP config file reload
K. Eugene Carlson <kvngncrlsn at gmail dot com>
Additional Linux memory reporting variables
Linux CPU frequency governor reporting
Additional FreeBSD memory reporting variables
Kapil Hari Paranjape <kapil@imsc.res.in>
ibm_volume patch
kFreeBSD support patch

View File

@ -1195,6 +1195,8 @@ values:
- mbox
- name: mem
desc: Amount of memory in use.
- name: memactive
desc: Amount of active memory. FreeBSD only.
- name: memavail
desc: Amount of available memory as recorded in /proc/meminfo. Linux 3.14+ only.
- name: membar
@ -1226,10 +1228,16 @@ values:
- (scale)
- (-t)
- (-l)
- name: meminactive
desc: Amount of inactive memory. FreeBSD only.
- name: memlaundry
desc: Amount of memory in laundry. FreeBSD only.
- name: memmax
desc: Total amount of memory.
- name: memperc
desc: Percentage of memory in use.
- name: memwired
desc: Amount of wired memory. FreeBSD only.
- name: memwithbuffers
desc: |-
Amount of memory in use, including that used by system

View File

@ -396,11 +396,15 @@ PRINT_HR_GENERATOR(mem)
PRINT_HR_GENERATOR(memwithbuffers)
PRINT_HR_GENERATOR(memeasyfree)
PRINT_HR_GENERATOR(legacymem)
PRINT_HR_GENERATOR(memactive)
PRINT_HR_GENERATOR(meminactive)
PRINT_HR_GENERATOR(memfree)
PRINT_HR_GENERATOR(memmax)
PRINT_HR_GENERATOR(memdirty)
PRINT_HR_GENERATOR(shmem)
PRINT_HR_GENERATOR(memavail)
PRINT_HR_GENERATOR(memwired)
PRINT_HR_GENERATOR(memlaundry)
PRINT_HR_GENERATOR(swap)
PRINT_HR_GENERATOR(swapfree)
PRINT_HR_GENERATOR(swapmax)

View File

@ -109,6 +109,10 @@ void print_memeasyfree(struct text_object *, char *, unsigned int);
void print_legacymem(struct text_object *, char *, unsigned int);
void print_memfree(struct text_object *, char *, unsigned int);
void print_memmax(struct text_object *, char *, unsigned int);
void print_memactive(struct text_object *, char *, unsigned int);
void print_meminactive(struct text_object *, char *, unsigned int);
void print_memwired(struct text_object *, char *, unsigned int);
void print_memlaundry(struct text_object *, char *, unsigned int);
void print_memdirty(struct text_object *, char *, unsigned int);
void print_shmem(struct text_object *, char *, unsigned int);
void print_memavail(struct text_object *, char *, unsigned int);

View File

@ -166,7 +166,8 @@ struct information {
/* memory information in kilobytes */
unsigned long long mem, memwithbuffers, memavail, memeasyfree, memfree,
memmax, memdirty, shmem, legacymem;
memmax, memdirty, shmem, legacymem, memactive, meminactive, memwired,
memlaundry;
unsigned long long swap, swapfree, swapmax;
unsigned long long bufmem, buffers, cached, free_bufcache;

View File

@ -1226,6 +1226,20 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
obj->callbacks.print = &print_free_bufcache;
obj->callbacks.free = &gen_free_opaque;
#endif /* __linux__ */
#ifdef __FreeBSD__
END OBJ(memactive, &update_meminfo) obj->data.s = STRNDUP_ARG;
obj->callbacks.print = &print_memactive;
obj->callbacks.free = &gen_free_opaque;
END OBJ(meminactive, &update_meminfo) obj->data.s = STRNDUP_ARG;
obj->callbacks.print = &print_meminactive;
obj->callbacks.free = &gen_free_opaque;
END OBJ(memwired, &update_meminfo) obj->data.s = STRNDUP_ARG;
obj->callbacks.print = &print_memwired;
obj->callbacks.free = &gen_free_opaque;
END OBJ(memlaundry, &update_meminfo) obj->data.s = STRNDUP_ARG;
obj->callbacks.print = &print_memlaundry;
obj->callbacks.free = &gen_free_opaque;
#endif /* __FreeBSD__ */
#ifdef BUILD_GUI
END OBJ(memgauge, &update_meminfo) scan_gauge(obj, arg, 1);
obj->callbacks.gaugeval = &mem_barval;

View File

@ -149,7 +149,8 @@ int check_mount(struct text_object *obj) {
}
int update_meminfo(void) {
u_int total_pages, inactive_pages, free_pages;
u_int total_pages, inactive_pages, free_pages, wire_pages, active_pages,
bufferspace, laundry_pages;
unsigned long swap_avail, swap_free;
int pagesize = getpagesize();
@ -166,11 +167,33 @@ int update_meminfo(void) {
fprintf(stderr, "Cannot read sysctl \"vm.stats.vm.v_inactive_count\"\n");
}
if (GETSYSCTL("vm.stats.vm.v_wire_count", wire_pages)) {
fprintf(stderr, "Cannot read sysctl \"vm.stats.vm.v_wire_count\"\n");
}
if (GETSYSCTL("vm.stats.vm.v_active_count", active_pages)) {
fprintf(stderr, "Cannot read sysctl \"vm.stats.vm.v_active_count\"\n");
}
if (GETSYSCTL("vfs.bufspace", bufferspace)) {
fprintf(stderr, "Cannot read sysctl \"vfs.bufspace\"\n");
}
if (GETSYSCTL("vm.stats.vm.v_laundry_count", laundry_pages)) {
fprintf(stderr, "Cannot read sysctl \"vm.stats.vm.v_laundry_count\"\n");
}
info.memmax = total_pages * (pagesize >> 10);
info.mem = (total_pages - free_pages - inactive_pages) * (pagesize >> 10);
info.memwithbuffers = info.mem;
info.memeasyfree = info.memfree = info.memmax - info.mem;
info.memeasyfree = info.memmax - info.mem;
info.memfree = free_pages * (pagesize >> 10);
info.legacymem = info.mem;
info.memwired = wire_pages * (pagesize >> 10);
info.memactive = active_pages * (pagesize >> 10);
info.meminactive = inactive_pages * (pagesize >> 10);
info.memlaundry = laundry_pages * (pagesize >> 10);
info.buffers = bufferspace / 1024;
if ((swapmode(&swap_avail, &swap_free)) >= 0) {
info.swapmax = swap_avail;