1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +00:00

Profiler: Move filter checks into their own function

This commit is contained in:
Gunnar Beutner 2021-05-07 13:48:32 +02:00 committed by Andreas Kling
parent 00de3b53c8
commit 2d6091be10
2 changed files with 11 additions and 4 deletions

View file

@ -96,10 +96,8 @@ void Profile::rebuild_tree()
continue;
}
if (has_process_filter()) {
if (event.pid != m_process_filter_pid || event.timestamp < m_process_filter_start_valid || event.timestamp > m_process_filter_end_valid)
continue;
}
if (!process_filter_contains(event.pid, event.timestamp))
continue;
m_filtered_event_indices.append(event_index);
@ -404,6 +402,14 @@ void Profile::clear_process_filter()
m_samples_model->update();
}
bool Profile::process_filter_contains(pid_t pid, u32 timestamp)
{
if (!has_process_filter())
return true;
return (pid == m_process_filter_pid && timestamp >= m_process_filter_start_valid && timestamp <= m_process_filter_end_valid);
}
void Profile::set_inverted(bool inverted)
{
if (m_inverted == inverted)