mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 04:00:05 +02:00
Slayer: ignore idle threads when computing CPU use.
This commit is contained in:
52
haiku-apps/slayer/patches/slayer-0.9.patchset
Normal file
52
haiku-apps/slayer/patches/slayer-0.9.patchset
Normal file
@@ -0,0 +1,52 @@
|
||||
From aa827341d670c542f8b8475ba3cc63384aa8537d Mon Sep 17 00:00:00 2001
|
||||
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
|
||||
Date: Thu, 12 Nov 2015 08:49:19 +0100
|
||||
Subject: Exclude Idle threads from CPU use compuation.
|
||||
|
||||
|
||||
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
|
||||
index 7f392a2..44f66f0 100644
|
||||
--- a/src/MainWindow.cpp
|
||||
+++ b/src/MainWindow.cpp
|
||||
@@ -282,6 +282,7 @@ void MainWindow::UpdateTeams()
|
||||
iteration = (iteration + 1) % 2;
|
||||
|
||||
total_CPU_diff = 0;
|
||||
+ int idle_CPU_diff = 0;
|
||||
|
||||
for (i = 0; get_next_team_info(&te_cookie, &teinf) == B_NO_ERROR; i++) {
|
||||
if (!(team_item = (TeamItem *)team_items_list->get(teinf.team))) {
|
||||
@@ -297,7 +298,10 @@ void MainWindow::UpdateTeams()
|
||||
thread_item->refreshed = iteration;
|
||||
team_item->thread_items_list->put(thinf.thread, thread_item);
|
||||
teamView->AddUnder(thread_item, team_item);
|
||||
- team_item->CPU_diff += thread_item->CPU_diff;
|
||||
+ if (teinf.team != 1 || strncmp(thinf.name, "idle thread ", 12) != 0) {
|
||||
+ team_item->CPU_diff += thread_item->CPU_diff;
|
||||
+ } else
|
||||
+ idle_CPU_diff += thread_item->CPU_diff;
|
||||
}
|
||||
}
|
||||
// update team
|
||||
@@ -318,13 +322,17 @@ void MainWindow::UpdateTeams()
|
||||
thread_item->update(&thinf);
|
||||
thread_item->refreshed = iteration;
|
||||
}
|
||||
- team_item->CPU_diff += thread_item->CPU_diff;
|
||||
+ if (teinf.team != 1 || strncmp(thinf.name, "idle thread ", 12) != 0) {
|
||||
+ team_item->CPU_diff += thread_item->CPU_diff;
|
||||
+ } else
|
||||
+ idle_CPU_diff += thread_item->CPU_diff;
|
||||
}
|
||||
|
||||
}
|
||||
total_CPU_diff += team_item->CPU_diff;
|
||||
if (total_CPU_diff < 0) printf("Error. CPU diff out of bounds\n");
|
||||
}
|
||||
+ total_CPU_diff += idle_CPU_diff;
|
||||
|
||||
// division by zero && overflow handling
|
||||
if (total_CPU_diff <= 0) total_CPU_diff = 1;
|
||||
--
|
||||
2.2.2
|
||||
|
||||
@@ -8,6 +8,8 @@ SOURCE_URI="git+https://github.com/HaikuArchives/Slayer.git#e04057b"
|
||||
REVISION="2"
|
||||
ARCHITECTURES="?x86 x86_gcc2"
|
||||
|
||||
PATCHES="slayer-$portVersion.patchset"
|
||||
|
||||
PROVIDES="
|
||||
slayer = $portVersion
|
||||
app:Slayer = $portVersion
|
||||
|
||||
Reference in New Issue
Block a user