From 952da97e1338852c8d5eeba380d2244a1f433edf Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 21 May 2015 15:27:33 -0400 Subject: Add a few new functions to LuminaOS: 1) CPUTemperatures() 2) CPUUsagePercent() 3) MemoryUsagePercent() These functions have been filled out for the LuminaOS-FreeBSD implementation, but not for any of the others yet. The FreeBSD implementation has also not been tested yet. Also add a new "DisplayNumberToBytes()" function into LuminaUtils for converting sizes in a string format (50M or 50MB for example) into a double with the number of bytes for calculations. --- libLumina/LuminaOS-Debian.cpp | 12 ++++++++++++ libLumina/LuminaOS-DragonFly.cpp | 13 +++++++++++++ libLumina/LuminaOS-FreeBSD.cpp | 32 ++++++++++++++++++++++++++++++++ libLumina/LuminaOS-Linux.cpp | 13 +++++++++++++ libLumina/LuminaOS-OpenBSD.cpp | 12 ++++++++++++ libLumina/LuminaOS-kFreeBSD.cpp | 12 ++++++++++++ libLumina/LuminaOS-template.cpp | 12 ++++++++++++ libLumina/LuminaOS.h | 5 +++++ libLumina/LuminaUtils.cpp | 16 ++++++++++++++++ libLumina/LuminaUtils.h | 1 + 10 files changed, 128 insertions(+) (limited to 'libLumina') diff --git a/libLumina/LuminaOS-Debian.cpp b/libLumina/LuminaOS-Debian.cpp index 650a2b5a..e3aabeae 100644 --- a/libLumina/LuminaOS-Debian.cpp +++ b/libLumina/LuminaOS-Debian.cpp @@ -235,4 +235,16 @@ QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as return capacity; } +QStringList LOS::CPUTemperatures(){ //Returns: List containing the temperature of any CPU's ("50C" for example) + return QStringList(); //not implemented yet +} + +int LOS::CPUUsagePercent(){ //Returns: Overall percentage of the amount of CPU cycles in use (-1 for errors) + return -1; //not implemented yet +} + +int LOS::MemoryUsagePercent(){ + return -1; //not implemented yet +} + #endif diff --git a/libLumina/LuminaOS-DragonFly.cpp b/libLumina/LuminaOS-DragonFly.cpp index 57ff1b2a..dde24d0c 100644 --- a/libLumina/LuminaOS-DragonFly.cpp +++ b/libLumina/LuminaOS-DragonFly.cpp @@ -194,4 +194,17 @@ QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as QString capacity = mountInfo[1].section(" ",4,4, skipEmpty); return capacity; } + +QStringList LOS::CPUTemperatures(){ //Returns: List containing the temperature of any CPU's ("50C" for example) + return QStringList(); //not implemented yet +} + +int LOS::CPUUsagePercent(){ //Returns: Overall percentage of the amount of CPU cycles in use (-1 for errors) + return -1; //not implemented yet +} + +int LOS::MemoryUsagePercent(){ + return -1; //not implemented yet +} + #endif diff --git a/libLumina/LuminaOS-FreeBSD.cpp b/libLumina/LuminaOS-FreeBSD.cpp index 7ef782d9..0843b1ce 100644 --- a/libLumina/LuminaOS-FreeBSD.cpp +++ b/libLumina/LuminaOS-FreeBSD.cpp @@ -255,4 +255,36 @@ QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as return capacity; } +QStringList LOS::CPUTemperatures(){ //Returns: List containing the temperature of any CPU's ("50C" for example) + QStringList temps = LUtils::getCmdOutput("sysctl -ai").filter(".temperature:"); + for(int i=0; i