aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Neumann <mneumann@ntecs.de>2015-08-16 17:36:17 +0200
committerMichael Neumann <mneumann@ntecs.de>2015-08-16 17:36:17 +0200
commite813145d30878d5b7bafc674d48610536e5d7777 (patch)
treeaff1c925b998a6494a82eb684d092de1941c083e
parentImplement CPUTemperatures() for DragonFly (diff)
downloadlumina-e813145d30878d5b7bafc674d48610536e5d7777.tar.gz
lumina-e813145d30878d5b7bafc674d48610536e5d7777.tar.bz2
lumina-e813145d30878d5b7bafc674d48610536e5d7777.zip
DragonFly: Sync MemoryUsagePercent() with FreeBSD
-rw-r--r--libLumina/LuminaOS-DragonFly.cpp7
1 files changed, 6 insertions, 1 deletions
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_<something>_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
bgstack15