From 27652bfd839475953801f5c7f4202176fd823457 Mon Sep 17 00:00:00 2001 From: turanszkij Date: Thu, 13 Oct 2016 21:50:35 +0200 Subject: [PATCH] cpu usage reader error report added --- WickedEngine/MainComponent.cpp | 12 +++++++++++- WickedEngine/wiCpuInfo.cpp | 2 +- WickedEngine/wiCpuInfo.h | 2 +- WickedEngine/wiVersion.cpp | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/WickedEngine/MainComponent.cpp b/WickedEngine/MainComponent.cpp index ea8d6d4e0..a32f85ade 100644 --- a/WickedEngine/MainComponent.cpp +++ b/WickedEngine/MainComponent.cpp @@ -175,7 +175,17 @@ void MainComponent::Compose() } if (infoDisplay.cpuinfo) { - ss << "CPU: " << wiCpuInfo::GetCpuPercentage() << "%" << endl; + int cpupercentage = wiCpuInfo::GetCpuPercentage(); + ss << "CPU: "; + if (cpupercentage >= 0) + { + ss << cpupercentage << "%"; + } + else + { + ss << "Query failed"; + } + ss << endl; } wiFont(ss.str(), wiFontProps(0, 0, infoDisplay.size, WIFALIGN_LEFT, WIFALIGN_TOP)).Draw(); } diff --git a/WickedEngine/wiCpuInfo.cpp b/WickedEngine/wiCpuInfo.cpp index d8b80fce8..2610d54bb 100644 --- a/WickedEngine/wiCpuInfo.cpp +++ b/WickedEngine/wiCpuInfo.cpp @@ -87,7 +87,7 @@ int wiCpuInfo::GetCpuPercentage() } else { - usage = 0; + usage = -1; } return usage; diff --git a/WickedEngine/wiCpuInfo.h b/WickedEngine/wiCpuInfo.h index 56d0e53ca..a3fa3e1ec 100644 --- a/WickedEngine/wiCpuInfo.h +++ b/WickedEngine/wiCpuInfo.h @@ -32,7 +32,7 @@ public: static void Initialize(){} static void Shutdown(){} static void Frame(){} - static int GetCpuPercentage(){ return 0; } + static int GetCpuPercentage(){ return -1; } #endif }; diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index 0be4edb69..c012c7add 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -7,7 +7,7 @@ namespace wiVersion // minor features, major updates const int minor = 9; // minor bug fixes, alterations, refactors, updates - const int revision = 13; + const int revision = 14; long GetVersion()