mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:27:35 +00:00
Kernel+Profiler: Track lost time between profiler timer ticks
We can lose profiling timer events for a few reasons, for example disabled interrupts or system slowness. This accounts for lost time between CPU samples by adding a field lost_samples to each profiling event which tracks how many samples were lost immediately preceding the event.
This commit is contained in:
parent
8614d18956
commit
c41f13f10b
8 changed files with 30 additions and 11 deletions
|
@ -228,6 +228,7 @@ Result<NonnullOwnPtr<Profile>, String> Profile::load_from_perfcore_file(const St
|
|||
Event event;
|
||||
|
||||
event.timestamp = perf_event.get("timestamp").to_number<u64>();
|
||||
event.lost_samples = perf_event.get("lost_samples").to_number<u32>();
|
||||
event.type = perf_event.get("type").to_string();
|
||||
event.pid = perf_event.get("pid").to_i32();
|
||||
event.tid = perf_event.get("tid").to_i32();
|
||||
|
|
|
@ -166,6 +166,7 @@ public:
|
|||
String executable;
|
||||
int pid { 0 };
|
||||
int tid { 0 };
|
||||
u32 lost_samples { 0 };
|
||||
bool in_kernel { false };
|
||||
Vector<Frame> frames;
|
||||
};
|
||||
|
|
|
@ -45,6 +45,8 @@ String SamplesModel::column_name(int column) const
|
|||
return "TID";
|
||||
case Column::ExecutableName:
|
||||
return "Executable";
|
||||
case Column::LostSamples:
|
||||
return "Lost Samples";
|
||||
case Column::InnermostStackFrame:
|
||||
return "Innermost Frame";
|
||||
default:
|
||||
|
@ -81,6 +83,10 @@ GUI::Variant SamplesModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
|
|||
return (u32)event.timestamp;
|
||||
}
|
||||
|
||||
if (index.column() == Column::LostSamples) {
|
||||
return event.lost_samples;
|
||||
}
|
||||
|
||||
if (index.column() == Column::InnermostStackFrame) {
|
||||
return event.frames.last().symbol;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ public:
|
|||
ProcessID,
|
||||
ThreadID,
|
||||
ExecutableName,
|
||||
LostSamples,
|
||||
InnermostStackFrame,
|
||||
__Count
|
||||
};
|
||||
|
|
|
@ -78,7 +78,7 @@ void TimelineTrack::paint_event(GUI::PaintEvent& event)
|
|||
}
|
||||
|
||||
auto& histogram = event.in_kernel ? kernel_histogram : usermode_histogram;
|
||||
histogram.insert(clamp_timestamp(event.timestamp), 1);
|
||||
histogram.insert(clamp_timestamp(event.timestamp), 1 + event.lost_samples);
|
||||
}
|
||||
|
||||
decltype(kernel_histogram.at(0)) max_value = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue