$OpenBSD: patch-ksysguard_ksysguardd_OpenBSD_memory_c,v 1.3 2014/09/16 20:02:35 espie Exp $
--- ksysguard/ksysguardd/OpenBSD/memory.c.orig	Mon Oct 10 09:04:31 2005
+++ ksysguard/ksysguardd/OpenBSD/memory.c	Tue Sep 16 13:56:31 2014
@@ -22,8 +22,9 @@
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
-#include <sys/dkstat.h>
+#include <sys/sched.h>
 #include <sys/swap.h>
+#include <sys/vmmeter.h>
 
 #include <limits.h>
 #include <stdio.h>
@@ -37,6 +38,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 +74,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 +104,9 @@ updateMemory(void)
 	InActive /= 1024;
 	InActive -= Active;
 
+	Used = Total - MFree;
+	Application = Used;
+
 	swapmode(&SUsed, &STotal);
 	SFree = STotal - SUsed;
 	return 0;
@@ -114,6 +122,30 @@ void
 printMFreeInfo(const char* cmd)
 {
 	fprintf(CurrentClient, "Free Memory\t0\t%d\tKB\n", Total);
+}
+
+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
