mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-10-26 14:57:54 +03:00
SystemMonitor: Fix calculation of CPU percentage
This commit addresses an issue when 'Zombie' threads are included in CPU % calculation. This caused negative time_scheduled_diff, resulting in a data type overflow.
This commit is contained in:
parent
89e2431517
commit
2e9fcc17a0
Notes:
sideshowbarker
2024-07-17 02:14:39 +09:00
Author: https://github.com/majso 🔰 Commit: https://github.com/SerenityOS/serenity/commit/2e9fcc17a0 Pull-request: https://github.com/SerenityOS/serenity/pull/20133 Issue: https://github.com/SerenityOS/serenity/issues/19842
@ -574,6 +574,9 @@ void ProcessModel::update()
|
||||
tids_to_remove.append(it.key);
|
||||
continue;
|
||||
}
|
||||
if (it.value->current_state.state == "Zombie") {
|
||||
continue;
|
||||
}
|
||||
auto& thread = *it.value;
|
||||
u64 time_scheduled_diff = (thread.current_state.time_user + thread.current_state.time_kernel)
|
||||
- (thread.previous_state.time_user + thread.previous_state.time_kernel);
|
||||
|
Loading…
Reference in New Issue
Block a user