1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

ProfileViewer: Precompute the timestamp and "in kernel?" per sample

Instead of fetching these from JSON in every paint event, we now have a
separate "SampleData" vector that can be iterated.

This optimization was made possible by profiling ProfileViewer and then
analyzing the profile with ProfileViewer! :^)
This commit is contained in:
Andreas Kling 2019-12-14 19:25:33 +01:00
parent 3fd2304dad
commit 4d6968f95d
3 changed files with 20 additions and 4 deletions

View file

@ -90,6 +90,13 @@ public:
});
}
struct SampleData {
u64 timestamp { 0 };
bool in_kernel { false };
};
const Vector<SampleData>& sample_data() const { return m_sample_data; }
u64 length_in_ms() const { return m_last_timestamp - m_first_timestamp; }
u64 first_timestamp() const { return m_first_timestamp; }
u64 last_timestamp() const { return m_first_timestamp; }
@ -109,6 +116,8 @@ private:
u64 m_first_timestamp { 0 };
u64 m_last_timestamp { 0 };
Vector<SampleData> m_sample_data;
bool m_has_timestamp_filter_range { false };
u64 m_timestamp_filter_range_start { 0 };
u64 m_timestamp_filter_range_end { 0 };