mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-28 04:09:00 +00:00
Profiler: Handle profiles with more kernel samples than user samples
Previously we assumed there were less kernel samples than user samples, by implicitly using the kernel histogram size for indicies to the user histogram. Such a profile can be reproduced by profiling a very short lived program like true: `profile -c true`
This commit is contained in:
parent
db68a52e23
commit
87bd98fe8e
Notes:
sideshowbarker
2024-07-18 02:13:10 +09:00
Author: https://github.com/IdanHo
Commit: 87bd98fe8e
Pull-request: https://github.com/SerenityOS/serenity/pull/10626
1 changed files with 9 additions and 1 deletions
|
@ -167,11 +167,19 @@ void TimelineTrack::recompute_histograms_if_needed(HistogramInputs const& inputs
|
|||
histogram.insert(clamp_timestamp(event.timestamp), 1 + event.lost_samples);
|
||||
}
|
||||
|
||||
for (size_t bucket = 0; bucket < m_kernel_histogram->size(); bucket++) {
|
||||
auto shorter_histogram_size = min(m_kernel_histogram->size(), m_user_histogram->size());
|
||||
for (size_t bucket = 0; bucket < shorter_histogram_size; ++bucket) {
|
||||
auto value = m_kernel_histogram->at(bucket) + m_user_histogram->at(bucket);
|
||||
if (value > m_max_value)
|
||||
m_max_value = value;
|
||||
}
|
||||
|
||||
auto& longer_histogram = m_kernel_histogram->size() > m_user_histogram->size() ? *m_kernel_histogram : *m_user_histogram;
|
||||
for (size_t bucket = shorter_histogram_size; bucket < longer_histogram.size(); ++bucket) {
|
||||
auto value = longer_histogram.at(bucket);
|
||||
if (value > m_max_value)
|
||||
m_max_value = value;
|
||||
}
|
||||
}
|
||||
|
||||
float TimelineTrack::column_width() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue