ProfileViewer: Ignore empty samples
Sometimes we get empty samples in a profile. I'm not sure why that happens, but let's just ignore them for now.
This commit is contained in:
parent
91ba94fbd4
commit
3b76f2502a
Notes:
sideshowbarker
2024-07-19 10:50:03 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3b76f2502aa
1 changed files with 6 additions and 1 deletions
|
@ -28,10 +28,15 @@ Profile::Profile(const JsonArray& json)
|
|||
|
||||
Sample sample;
|
||||
sample.timestamp = sample_object.get("timestamp").to_number<u64>();
|
||||
sample.in_kernel = sample_object.get("frames").as_array().at(1).as_object().get("address").to_number<u32>() < (8 * MB);
|
||||
|
||||
auto frames_value = sample_object.get("frames");
|
||||
auto& frames_array = frames_value.as_array();
|
||||
|
||||
if (frames_array.size() < 2)
|
||||
continue;
|
||||
|
||||
sample.in_kernel = frames_array.at(1).as_object().get("address").to_number<u32>() < (8 * MB);
|
||||
|
||||
for (int i = frames_array.size() - 1; i >= 1; --i) {
|
||||
auto& frame_value = frames_array.at(i);
|
||||
auto& frame_object = frame_value.as_object();
|
||||
|
|
Loading…
Add table
Reference in a new issue