1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:47:35 +00:00

Profiler: Add source code view

This adds a new view mode to profiler which displays source lines and
samples that occured at those lines. This view can be opened via the
menu or by pressing CTRL-S.

It does this by mapping file names from DWARF to "/usr/src/serenity/..."
i.e. source code should be copied to /usr/src/serenity/Userland and
/usr/src/serenity/Kernel to be visible in this mode.

Currently *all* files contributing to the selected function are loaded
completely which could be a lot of data when dealing with lots of
inlined code.
This commit is contained in:
Stephan Unverwerth 2021-12-27 01:25:58 +01:00 committed by Andreas Kling
parent e6df1c9988
commit cf8427b7b4
6 changed files with 315 additions and 0 deletions

View file

@ -12,6 +12,7 @@
#include "ProfileModel.h"
#include "SamplesModel.h"
#include "SignpostsModel.h"
#include "SourceModel.h"
#include <AK/Bitmap.h>
#include <AK/FlyString.h>
#include <AK/JsonArray.h>
@ -147,6 +148,7 @@ public:
GUI::Model& samples_model();
GUI::Model& signposts_model();
GUI::Model* disassembly_model();
GUI::Model* source_model();
const Process* find_process(pid_t pid, EventSerialNumber serial) const
{
@ -157,6 +159,7 @@ public:
}
void set_disassembly_index(const GUI::ModelIndex&);
void set_source_index(const GUI::ModelIndex&);
const Vector<NonnullRefPtr<ProfileNode>>& roots() const { return m_roots; }
@ -281,8 +284,10 @@ private:
RefPtr<SamplesModel> m_samples_model;
RefPtr<SignpostsModel> m_signposts_model;
RefPtr<DisassemblyModel> m_disassembly_model;
RefPtr<SourceModel> m_source_model;
GUI::ModelIndex m_disassembly_index;
GUI::ModelIndex m_source_index;
Vector<NonnullRefPtr<ProfileNode>> m_roots;
Vector<size_t> m_filtered_event_indices;