Date: Mon, 22 Dec 2003 13:47:49 +0100 (CET) From: Markus Brueffer <brueffer@phoenix-systems.de> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/60502: [patch] x11/kdebase3: fix memory statistics of ksysguardd Message-ID: <20031222124749.28739184@maquis.hitnet.rwth-aachen.de> Resent-Message-ID: <200312221240.hBMCeJew083113@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 60502 >Category: ports >Synopsis: [patch] x11/kdebase3: fix memory statistics of ksysguardd >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Dec 22 04:40:17 PST 2003 >Closed-Date: >Last-Modified: >Originator: Markus Brueffer >Release: FreeBSD 5.2-CURRENT i386 >Organization: >Environment: System: FreeBSD cheops.phoenix 5.2-CURRENT FreeBSD 5.2-CURRENT #16: Mon Dec 22 00:35:14 CET 2003 root@cheops.phoenix:/usr/obj/usr/src/sys/CHEOPS i386 >Description: The default memory-pane of ksysguard fails to display any memory statistics. This is caused by a lacking implementation of the sensor mem/physical/application in ksysguardd. The attached patches implement this sensor. This causes updating of the default mem-pane to fail. >How-To-Repeat: >Fix: --- kdebase3.diff begins here --- diff -ruN kdebase3.orig/files/patch-ksysguard-ksysguardd-FreeBSD-Memory.c kdebase3/files/patch-ksysguard-ksysguardd-FreeBSD-Memory.c --- kdebase3.orig/files/patch-ksysguard-ksysguardd-FreeBSD-Memory.c Thu Jan 1 01:00:00 1970 +++ kdebase3/files/patch-ksysguard-ksysguardd-FreeBSD-Memory.c Mon Dec 22 13:15:43 2003 @@ -0,0 +1,71 @@ +--- ksysguard/ksysguardd/FreeBSD/Memory.c.orig Mon Dec 15 01:58:03 2003 ++++ ksysguard/ksysguardd/FreeBSD/Memory.c Mon Dec 15 03:26:35 2003 +@@ -45,6 +45,7 @@ + static size_t Used = 0; + static size_t Buffers = 0; + static size_t Cached = 0; ++static size_t Application = 0; + static size_t STotal = 0; + static size_t SFree = 0; + static size_t SUsed = 0; +@@ -66,6 +67,7 @@ + registerMonitor("mem/physical/used", "integer", printUsed, printUsedInfo, sm); + registerMonitor("mem/physical/buf", "integer", printBuffers, printBuffersInfo, sm); + registerMonitor("mem/physical/cached", "integer", printCached, printCachedInfo, 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); + } +@@ -80,7 +82,6 @@ + updateMemory(void) + { + size_t len; +- struct vmtotal p; + FILE *file; + char buf[256]; + struct kvm_swap kswap[16]; +@@ -108,18 +109,18 @@ + Buffers = 0; /* Doesn't work under FreeBSD v2.2.x */ + Buffers /= 1024; + +- + len = sizeof (Cached); + if ((sysctlbyname("vm.stats.vm.v_cache_count", &Cached, &len, NULL, 0) == -1) || !len) + Cached = 0; /* Doesn't work under FreeBSD v2.2.x */ +- Cached *= getpagesize() / 1024; ++ Cached *= pagesize / 1024; + ++ len = sizeof (MFree); ++ if ((sysctlbyname("vm.stats.vm.v_free_count", &MFree, &len, NULL, 0) == -1) || !len) ++ MFree = 0; /* Doesn't work under FreeBSD v2.2.x */ ++ MFree *= pagesize / 1024; + +- /* initializes the pointer to the vmmeter struct */ +- len = sizeof (p); +- sysctlbyname("vm.vmmeter", &p, &len, NULL, 0); +- MFree = p.t_free * getpagesize() / 1024; +- Used = p.t_arm * getpagesize() / 1024 + Buffers + Cached; ++ Used = Total - MFree; ++ Application = Used - Buffers - Cached; + + return 0; + } +@@ -170,6 +171,18 @@ + printCachedInfo(const char* cmd) + { + fprintf(CurrentClient, "Cached 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%d\tKB\n", Total); + } + + void diff -ruN kdebase3.orig/files/patch-ksysguard-ksysguardd-FreeBSD-Memory.h kdebase3/files/patch-ksysguard-ksysguardd-FreeBSD-Memory.h --- kdebase3.orig/files/patch-ksysguard-ksysguardd-FreeBSD-Memory.h Thu Jan 1 01:00:00 1970 +++ kdebase3/files/patch-ksysguard-ksysguardd-FreeBSD-Memory.h Mon Dec 22 13:15:43 2003 @@ -0,0 +1,11 @@ +--- ksysguard/ksysguardd/FreeBSD/Memory.h.orig Mon Dec 15 01:58:03 2003 ++++ ksysguard/ksysguardd/FreeBSD/Memory.h Mon Dec 15 01:58:03 2003 +@@ -36,6 +36,8 @@ + void printBuffersInfo(const char* cmd); + void printCached(const char* cmd); + void printCachedInfo(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); --- kdebase3.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031222124749.28739184>