mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-22 11:40:06 +02:00
SystemInfo: Add patch for update to new sysinfo API
GCI2014 Signed-off-by: François Revol <revol@free.fr>
This commit is contained in:
committed by
François Revol
parent
ae508264d3
commit
7df9dec9c3
41
haiku-apps/systeminfo/patches/systeminfo-2-2.patchset
Normal file
41
haiku-apps/systeminfo/patches/systeminfo-2-2.patchset
Normal file
@@ -0,0 +1,41 @@
|
||||
From d0ea409005cecef76c6fcb7a0cefd0a662d340e0 Mon Sep 17 00:00:00 2001
|
||||
From: Chirayu Desai <chirayudesai1@gmail.com>
|
||||
Date: Wed, 3 Dec 2014 19:50:33 +0000
|
||||
Subject: [PATCH] CPUPercent: Update for new API
|
||||
|
||||
---
|
||||
CPUPercent.cpp | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/CPUPercent.cpp b/CPUPercent.cpp
|
||||
index 3e4c8e8931..4225f73642 100644
|
||||
--- a/CPUPercent.cpp
|
||||
+++ b/CPUPercent.cpp
|
||||
@@ -19,17 +19,22 @@ void CPU_Percent::Update()
|
||||
{
|
||||
system_info info;
|
||||
get_system_info(&info);
|
||||
+
|
||||
+ cpu_info* cpuInfos = new cpu_info[info.cpu_count];
|
||||
+ get_cpu_info(0, info.cpu_count, cpuInfos);
|
||||
|
||||
delta_system = (double)system_time() - last_system_time;
|
||||
- delta_cpu = double(info.cpu_infos[theCPU].active_time) - last_active_cpu_time;
|
||||
+ delta_cpu = double(cpuInfos[theCPU].active_time) - last_active_cpu_time;
|
||||
|
||||
percent = (delta_cpu/delta_system);
|
||||
if(percent < 0) percent = 0.00;
|
||||
if(percent > 1) percent = 1.00;
|
||||
|
||||
lastpercent = percent;
|
||||
- last_active_cpu_time = (double)info.cpu_infos[theCPU].active_time;
|
||||
+ last_active_cpu_time = (double)cpuInfos[theCPU].active_time;
|
||||
last_system_time = (double)system_time();
|
||||
+
|
||||
+ delete[] cpuInfos;
|
||||
}
|
||||
|
||||
double CPU_Percent::Percentage()
|
||||
--
|
||||
1.8.3.4
|
||||
|
||||
@@ -37,6 +37,10 @@ BUILD_PREREQUIRES="
|
||||
cmd:xres
|
||||
"
|
||||
|
||||
PATCHES="
|
||||
systeminfo-2-2.patchset
|
||||
"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
echo "const uint32 CP_CHANGE_BG = 'CPBG'; const uint32 CP_CHANGE_FG = 'CPFG';" > ./DigitalView.h
|
||||
|
||||
Reference in New Issue
Block a user