From e813145d30878d5b7bafc674d48610536e5d7777 Mon Sep 17 00:00:00 2001 From: Michael Neumann Date: Sun, 16 Aug 2015 17:36:17 +0200 Subject: DragonFly: Sync MemoryUsagePercent() with FreeBSD --- libLumina/LuminaOS-DragonFly.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libLumina/LuminaOS-DragonFly.cpp b/libLumina/LuminaOS-DragonFly.cpp index 13de5329..d1a5f6c0 100644 --- a/libLumina/LuminaOS-DragonFly.cpp +++ b/libLumina/LuminaOS-DragonFly.cpp @@ -262,7 +262,12 @@ int LOS::CPUUsagePercent(){ //Returns: Overall percentage of the amount of CPU c } int LOS::MemoryUsagePercent(){ - return -1; //not implemented yet + //SYSCTL: vm.stats.vm.v__count + QStringList info = LUtils::getCmdOutput("sysctl -n vm.stats.vm.v_page_count vm.stats.vm.v_wire_count vm.stats.vm.v_active_count"); + if(info.length()<3){ return -1; } //error in fetching information + //List output: [total, wired, active] + double perc = 100.0* (info[1].toLong()+info[2].toLong())/(info[0].toDouble()); + return qRound(perc); } QStringList LOS::DiskUsage(){ //Returns: List of current read/write stats for each device -- cgit