Skip to content

Commit

Permalink
ProfileViewer: Ignore empty samples
Browse files Browse the repository at this point in the history
Sometimes we get empty samples in a profile. I'm not sure why that
happens, but let's just ignore them for now.
  • Loading branch information
awesomekling committed Dec 16, 2019
1 parent 91ba94f commit 3b76f25
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion DevTools/ProfileViewer/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 3b76f25

Please sign in to comment.