1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-27 04:32:55 +00:00

add a $memdirty variable

patch contributed by Piotr Karbowski (sf.net #3138195)
This commit is contained in:
Pavel Labath 2011-01-04 14:48:33 +01:00
parent 5237fe9d23
commit 87591f502e
6 changed files with 19 additions and 2 deletions

View File

@ -2032,6 +2032,15 @@
<listitem>Bar that shows amount of memory in use (including memory used by system buffers and caches)
<para /></listitem>
</varlistentry>
<varlistentry>
<term>
<command>
<option>memdirty</option>
</command>
</term>
<listitem>Amount of "dirty" memory (linux only)
<para /></listitem>
</varlistentry>
<varlistentry>
<term>
<command>

View File

@ -526,6 +526,7 @@ PRINT_HR_GENERATOR(memwithbuffers)
PRINT_HR_GENERATOR(memeasyfree)
PRINT_HR_GENERATOR(memfree)
PRINT_HR_GENERATOR(memmax)
PRINT_HR_GENERATOR(memdirty)
PRINT_HR_GENERATOR(swap)
PRINT_HR_GENERATOR(swapfree)
PRINT_HR_GENERATOR(swapmax)

View File

@ -107,6 +107,7 @@ void print_memwithbuffers(struct text_object *, char *, int);
void print_memeasyfree(struct text_object *, char *, int);
void print_memfree(struct text_object *, char *, int);
void print_memmax(struct text_object *, char *, int);
void print_memdirty(struct text_object *, char *, int);
void print_swap(struct text_object *, char *, int);
void print_swapfree(struct text_object *, char *, int);
void print_swapmax(struct text_object *, char *, int);

View File

@ -196,7 +196,7 @@ struct information {
double uptime;
/* memory information in kilobytes */
unsigned long long mem, memwithbuffers, memeasyfree, memfree, memmax;
unsigned long long mem, memwithbuffers, memeasyfree, memfree, memmax, memdirty;
unsigned long long swap, swapfree, swapmax;
unsigned long long bufmem, buffers, cached;

View File

@ -985,6 +985,10 @@ struct text_object *construct_text_object(char *s, const char *arg, long
obj->callbacks.print = &print_memmax;
END OBJ(memperc, &update_meminfo)
obj->callbacks.percentage = &mem_percentage;
#ifdef __linux__
END OBJ(memdirty, &update_meminfo)
obj->callbacks.print = &print_memdirty;
#endif
#ifdef BUILD_X11
END OBJ(memgauge, &update_meminfo)
scan_gauge(obj, arg, 1);

View File

@ -165,7 +165,7 @@ int update_meminfo(void)
/* unsigned int a; */
char buf[256];
info.mem = info.memwithbuffers = info.memmax = info.swap = info.swapfree = info.swapmax =
info.mem = info.memwithbuffers = info.memmax = info.memdirty = info.swap = info.swapfree = info.swapmax =
info.bufmem = info.buffers = info.cached = info.memfree = info.memeasyfree = 0;
if (!(meminfo_fp = open_file("/proc/meminfo", &rep))) {
@ -189,6 +189,8 @@ int update_meminfo(void)
sscanf(buf, "%*s %llu", &info.buffers);
} else if (strncmp(buf, "Cached:", 7) == 0) {
sscanf(buf, "%*s %llu", &info.cached);
} else if (strncmp(buf, "Dirty:", 6) == 0) {
sscanf(buf, "%*s %llu", &info.memdirty);
}
}