mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:07:35 +00:00
Profiler: Move filter checks into their own function
This commit is contained in:
parent
00de3b53c8
commit
2d6091be10
2 changed files with 11 additions and 4 deletions
|
@ -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)
|
||||
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)
|
||||
|
|
|
@ -174,6 +174,7 @@ public:
|
|||
void set_process_filter(pid_t pid, u64 start_valid, u64 end_valid);
|
||||
void clear_process_filter();
|
||||
bool has_process_filter() const { return m_has_process_filter; }
|
||||
bool process_filter_contains(pid_t pid, u32 timestamp);
|
||||
|
||||
bool is_inverted() const { return m_inverted; }
|
||||
void set_inverted(bool);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue