summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/DevTools/Profiler/Profile.cpp14
-rw-r--r--Userland/DevTools/Profiler/Profile.h2
-rw-r--r--Userland/DevTools/Profiler/TimelineTrack.cpp2
3 files changed, 15 insertions, 3 deletions
diff --git a/Userland/DevTools/Profiler/Profile.cpp b/Userland/DevTools/Profiler/Profile.cpp
index 640636a5c4..61f0f0524a 100644
--- a/Userland/DevTools/Profiler/Profile.cpp
+++ b/Userland/DevTools/Profiler/Profile.cpp
@@ -208,6 +208,17 @@ Result<NonnullOwnPtr<Profile>, String> Profile::load_from_perfcore_file(const St
if (!file_or_error.is_error())
kernel_elf = make<ELF::Image>(file_or_error.value()->bytes());
+ auto strings_value = object.get_ptr("strings"sv);
+ if (!strings_value || !strings_value->is_object())
+ return String { "Malformed profile (strings is not an object)" };
+
+ HashMap<FlatPtr, String> profile_strings;
+ strings_value->as_object().for_each_member([&](String const& key, JsonValue const& value) {
+ auto string_id = key.to_uint();
+ VERIFY(string_id.has_value());
+ profile_strings.set(string_id.value(), value.to_string());
+ });
+
auto events_value = object.get_ptr("events");
if (!events_value || !events_value->is_array())
return String { "Malformed profile (events is not an array)" };
@@ -242,7 +253,8 @@ Result<NonnullOwnPtr<Profile>, String> Profile::load_from_perfcore_file(const St
event.ptr = perf_event.get("ptr").to_number<FlatPtr>();
} else if (event.type == "signpost"sv) {
is_signpost = true;
- event.arg1 = perf_event.get("arg1").to_number<FlatPtr>();
+ auto string_id = perf_event.get("arg1").to_number<FlatPtr>();
+ event.signpost_string = profile_strings.get(string_id).value_or(String::formatted("Signpost #{}", string_id));
event.arg2 = perf_event.get("arg2").to_number<FlatPtr>();
} else if (event.type == "mmap"sv) {
event.ptr = perf_event.get("ptr").to_number<FlatPtr>();
diff --git a/Userland/DevTools/Profiler/Profile.h b/Userland/DevTools/Profiler/Profile.h
index e1c75a281e..cb5cc30327 100644
--- a/Userland/DevTools/Profiler/Profile.h
+++ b/Userland/DevTools/Profiler/Profile.h
@@ -178,7 +178,7 @@ public:
bool in_kernel { false };
// FIXME: Put event type-specific arguments in a union to save memory.
- FlatPtr arg1 {};
+ String signpost_string;
FlatPtr arg2 {};
Vector<Frame> frames;
diff --git a/Userland/DevTools/Profiler/TimelineTrack.cpp b/Userland/DevTools/Profiler/TimelineTrack.cpp
index 3d75d8ce7b..8b7158ba3a 100644
--- a/Userland/DevTools/Profiler/TimelineTrack.cpp
+++ b/Userland/DevTools/Profiler/TimelineTrack.cpp
@@ -135,7 +135,7 @@ void TimelineTrack::mousemove_event(GUI::MouseEvent& event)
constexpr int hoverable_padding = 2;
Gfx::IntRect hoverable_rect { x - hoverable_padding, frame_thickness(), hoverable_padding * 2, height() - frame_thickness() * 2 };
if (hoverable_rect.contains_horizontally(event.x())) {
- GUI::Application::the()->show_tooltip_immediately(String::formatted("Signpost {}, {}", signpost.arg1, signpost.arg2), this);
+ GUI::Application::the()->show_tooltip_immediately(String::formatted("Signpost {}, {}", signpost.signpost_string, signpost.arg2), this);
hovering_a_signpost = true;
return IterationDecision::Break;
}