mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:17:34 +00:00
SystemMonitor: Use HashMap::ensure() in ProcessModel::update()
This commit is contained in:
parent
e40e91b9df
commit
6f6473d6a4
1 changed files with 3 additions and 9 deletions
|
@ -369,15 +369,9 @@ void ProcessModel::update()
|
||||||
state.state = thread.state;
|
state.state = thread.state;
|
||||||
sum_time_scheduled += thread.time_user + thread.time_kernel;
|
sum_time_scheduled += thread.time_user + thread.time_kernel;
|
||||||
sum_time_scheduled_kernel += thread.time_kernel;
|
sum_time_scheduled_kernel += thread.time_kernel;
|
||||||
{
|
auto& thread_data = *m_threads.ensure(thread.tid, [] { return make<Thread>(); });
|
||||||
auto pit = m_threads.find(thread.tid);
|
thread_data.previous_state = move(thread_data.current_state);
|
||||||
if (pit == m_threads.end())
|
thread_data.current_state = move(state);
|
||||||
m_threads.set(thread.tid, make<Thread>());
|
|
||||||
}
|
|
||||||
auto pit = m_threads.find(thread.tid);
|
|
||||||
VERIFY(pit != m_threads.end());
|
|
||||||
(*pit).value->previous_state = (*pit).value->current_state;
|
|
||||||
(*pit).value->current_state = state;
|
|
||||||
|
|
||||||
live_tids.set(thread.tid);
|
live_tids.set(thread.tid);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue