summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrançois Andriot <francois.andriot@free.fr>2014-10-13 01:09:50 +0200
committerSlávek Banko <slavek.banko@axis.cz>2014-10-13 01:11:25 +0200
commit794af5ed134375d4f12843510a491ba20b94a7f2 (patch)
tree948d8644f2b5c3e10c486db3b002437a1cfde37f
parentffb5336b8c535f6ef663bdedd494b292931aabfc (diff)
downloadtdebase-794af5ed134375d4f12843510a491ba20b94a7f2.tar.gz
tdebase-794af5ed134375d4f12843510a491ba20b94a7f2.zip
Enhance memory management in ksysguard on openbsd
-rw-r--r--ksysguard/ksysguardd/OpenBSD/memory.c31
-rw-r--r--ksysguard/ksysguardd/OpenBSD/memory.h4
2 files changed, 35 insertions, 0 deletions
diff --git a/ksysguard/ksysguardd/OpenBSD/memory.c b/ksysguard/ksysguardd/OpenBSD/memory.c
index aaf893268..3deb88229 100644
--- a/ksysguard/ksysguardd/OpenBSD/memory.c
+++ b/ksysguard/ksysguardd/OpenBSD/memory.c
@@ -37,6 +37,8 @@
static size_t Total = 0;
static size_t MFree = 0;
+static size_t Used = 0;
+static size_t Application = 0;
static size_t Active = 0;
static size_t InActive = 0;
static size_t STotal = 0;
@@ -71,6 +73,8 @@ initMemory(struct SensorModul* sm)
registerMonitor("mem/physical/free", "integer", printMFree, printMFreeInfo, sm);
registerMonitor("mem/physical/active", "integer", printActive, printActiveInfo, sm);
registerMonitor("mem/physical/inactive", "integer", printInActive, printInActiveInfo, sm);
+ registerMonitor("mem/physical/used", "integer", printUsed, printUsedInfo, sm);
+ registerMonitor("mem/physical/application", "integer", printApplication, printApplicationInfo, sm);
registerMonitor("mem/swap/free", "integer", printSwapFree, printSwapFreeInfo, sm);
registerMonitor("mem/swap/used", "integer", printSwapUsed, printSwapUsedInfo, sm);
}
@@ -99,6 +103,9 @@ updateMemory(void)
InActive /= 1024;
InActive -= Active;
+ Used = Total - MFree;
+ Application = Used;
+
swapmode(&SUsed, &STotal);
SFree = STotal - SUsed;
return 0;
@@ -117,6 +124,30 @@ printMFreeInfo(const char* cmd)
}
void
+printUsed(const char* cmd)
+{
+ fprintf(CurrentClient, "%d\n", Used);
+}
+
+void
+printUsedInfo(const char* cmd)
+{
+ fprintf(CurrentClient, "Used Memory\t0\t%d\tKB\n", Total);
+}
+
+void
+printApplication(const char* cmd)
+{
+ fprintf(CurrentClient, "%d\n", Application);
+}
+
+void
+printApplicationInfo(const char* cmd)
+{
+ fprintf(CurrentClient, "Application Memory\t0\t%ld\tKB\n", Total);
+}
+
+void
printActive(const char* cmd)
{
fprintf(CurrentClient, "%d\n", Active);
diff --git a/ksysguard/ksysguardd/OpenBSD/memory.h b/ksysguard/ksysguardd/OpenBSD/memory.h
index 9cb11373a..905c5906e 100644
--- a/ksysguard/ksysguardd/OpenBSD/memory.h
+++ b/ksysguard/ksysguardd/OpenBSD/memory.h
@@ -35,6 +35,10 @@ void printActive(const char* cmd);
void printActiveInfo(const char* cmd);
void printInActive(const char* cmd);
void printInActiveInfo(const char* cmd);
+void printUsed(const char* cmd);
+void printUsedInfo(const char* cmd);
+void printApplication(const char* cmd);
+void printApplicationInfo(const char* cmd);
void printSwapUsed(const char* cmd);
void printSwapUsedInfo(const char* cmd);
void printSwapFree(const char* cmd);