1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 04:17:33 +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 :) Some cleaning and commenting apparently :)
SIGHUP config file reload 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> Kapil Hari Paranjape <kapil@imsc.res.in>
ibm_volume patch ibm_volume patch
kFreeBSD support patch kFreeBSD support patch

View File

@ -1195,6 +1195,8 @@ values:
- mbox - mbox
- name: mem - name: mem
desc: Amount of memory in use. desc: Amount of memory in use.
- name: memactive
desc: Amount of active memory. FreeBSD only.
- name: memavail - name: memavail
desc: Amount of available memory as recorded in /proc/meminfo. Linux 3.14+ only. desc: Amount of available memory as recorded in /proc/meminfo. Linux 3.14+ only.
- name: membar - name: membar
@ -1226,10 +1228,16 @@ values:
- (scale) - (scale)
- (-t) - (-t)
- (-l) - (-l)
- name: meminactive
desc: Amount of inactive memory. FreeBSD only.
- name: memlaundry
desc: Amount of memory in laundry. FreeBSD only.
- name: memmax - name: memmax
desc: Total amount of memory. desc: Total amount of memory.
- name: memperc - name: memperc
desc: Percentage of memory in use. desc: Percentage of memory in use.
- name: memwired
desc: Amount of wired memory. FreeBSD only.
- name: memwithbuffers - name: memwithbuffers
desc: |- desc: |-
Amount of memory in use, including that used by system 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(memwithbuffers)
PRINT_HR_GENERATOR(memeasyfree) PRINT_HR_GENERATOR(memeasyfree)
PRINT_HR_GENERATOR(legacymem) PRINT_HR_GENERATOR(legacymem)
PRINT_HR_GENERATOR(memactive)
PRINT_HR_GENERATOR(meminactive)
PRINT_HR_GENERATOR(memfree) PRINT_HR_GENERATOR(memfree)
PRINT_HR_GENERATOR(memmax) PRINT_HR_GENERATOR(memmax)
PRINT_HR_GENERATOR(memdirty) PRINT_HR_GENERATOR(memdirty)
PRINT_HR_GENERATOR(shmem) PRINT_HR_GENERATOR(shmem)
PRINT_HR_GENERATOR(memavail) PRINT_HR_GENERATOR(memavail)
PRINT_HR_GENERATOR(memwired)
PRINT_HR_GENERATOR(memlaundry)
PRINT_HR_GENERATOR(swap) PRINT_HR_GENERATOR(swap)
PRINT_HR_GENERATOR(swapfree) PRINT_HR_GENERATOR(swapfree)
PRINT_HR_GENERATOR(swapmax) PRINT_HR_GENERATOR(swapmax)
@ -640,7 +644,7 @@ void print_battery_time(struct text_object *obj, char *p,
} }
void battery_power_draw(struct text_object *obj, char *p, void battery_power_draw(struct text_object *obj, char *p,
unsigned int p_max_size) { unsigned int p_max_size) {
get_battery_power_draw(p, p_max_size, obj->data.s); get_battery_power_draw(p, p_max_size, obj->data.s);
} }

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_legacymem(struct text_object *, char *, unsigned int);
void print_memfree(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_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_memdirty(struct text_object *, char *, unsigned int);
void print_shmem(struct text_object *, char *, unsigned int); void print_shmem(struct text_object *, char *, unsigned int);
void print_memavail(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 */ /* memory information in kilobytes */
unsigned long long mem, memwithbuffers, memavail, memeasyfree, memfree, 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 swap, swapfree, swapmax;
unsigned long long bufmem, buffers, cached, free_bufcache; 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.print = &print_free_bufcache;
obj->callbacks.free = &gen_free_opaque; obj->callbacks.free = &gen_free_opaque;
#endif /* __linux__ */ #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 #ifdef BUILD_GUI
END OBJ(memgauge, &update_meminfo) scan_gauge(obj, arg, 1); END OBJ(memgauge, &update_meminfo) scan_gauge(obj, arg, 1);
obj->callbacks.gaugeval = &mem_barval; obj->callbacks.gaugeval = &mem_barval;

View File

@ -149,7 +149,8 @@ int check_mount(struct text_object *obj) {
} }
int update_meminfo(void) { 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; unsigned long swap_avail, swap_free;
int pagesize = getpagesize(); int pagesize = getpagesize();
@ -166,11 +167,33 @@ int update_meminfo(void) {
fprintf(stderr, "Cannot read sysctl \"vm.stats.vm.v_inactive_count\"\n"); 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.memmax = total_pages * (pagesize >> 10);
info.mem = (total_pages - free_pages - inactive_pages) * (pagesize >> 10); info.mem = (total_pages - free_pages - inactive_pages) * (pagesize >> 10);
info.memwithbuffers = info.mem; 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.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) { if ((swapmode(&swap_avail, &swap_free)) >= 0) {
info.swapmax = swap_avail; info.swapmax = swap_avail;