Profiler: Move everything into the "Profiler" namespace

This commit is contained in:
Andreas Kling 2021-05-04 17:45:02 +02:00
parent d29e2dd2d7
commit dbbc6096a9
Notes: sideshowbarker 2024-07-18 18:43:08 +09:00
17 changed files with 66 additions and 0 deletions

View file

@ -14,6 +14,8 @@
#include <ctype.h>
#include <stdio.h>
namespace Profiler {
static const Gfx::Bitmap& heat_gradient()
{
static RefPtr<Gfx::Bitmap> bitmap;
@ -185,3 +187,5 @@ void DisassemblyModel::update()
{
did_update();
}
}

View file

@ -9,6 +9,8 @@
#include <LibGUI/Model.h>
#include <LibX86/Instruction.h>
namespace Profiler {
class Profile;
class ProfileNode;
@ -53,3 +55,5 @@ private:
Vector<InstructionData> m_instructions;
};
}

View file

@ -9,6 +9,8 @@
#include <AK/StringBuilder.h>
#include <stdio.h>
namespace Profiler {
IndividualSampleModel::IndividualSampleModel(Profile& profile, size_t event_index)
: m_profile(profile)
, m_event_index(event_index)
@ -69,3 +71,5 @@ void IndividualSampleModel::update()
{
did_update(Model::InvalidateAllIndices);
}
}

View file

@ -8,6 +8,8 @@
#include <LibGUI/Model.h>
namespace Profiler {
class Profile;
class IndividualSampleModel final : public GUI::Model {
@ -38,3 +40,5 @@ private:
Profile& m_profile;
const size_t m_event_index { 0 };
};
}

View file

@ -6,6 +6,8 @@
#include "Process.h"
namespace Profiler {
Thread* Process::find_thread(pid_t tid, u64 timestamp)
{
auto it = threads.find(tid);
@ -115,3 +117,5 @@ const LibraryMetadata::Library* LibraryMetadata::library_containing(FlatPtr ptr)
}
return nullptr;
}
}

View file

@ -12,6 +12,8 @@
#include <AK/Vector.h>
#include <LibELF/Image.h>
namespace Profiler {
struct MappedObject {
NonnullRefPtr<MappedFile> file;
ELF::Image elf;
@ -66,3 +68,5 @@ struct Process {
return timestamp >= start_valid && (end_valid == 0 || timestamp <= end_valid);
}
};
}

View file

@ -10,6 +10,8 @@
#include <LibGUI/ItemListModel.h>
#include <LibGUI/Label.h>
namespace Profiler {
ProcessPickerWidget::ProcessPickerWidget(Profile& profile)
: m_profile(profile)
{
@ -46,3 +48,5 @@ ProcessPickerWidget::ProcessPickerWidget(Profile& profile)
ProcessPickerWidget::~ProcessPickerWidget()
{
}
}

View file

@ -9,6 +9,8 @@
#include <LibGUI/ComboBox.h>
#include <LibGUI/Frame.h>
namespace Profiler {
class Profile;
class ProcessPickerWidget final : public GUI::Frame {
@ -29,3 +31,5 @@ private:
RefPtr<GUI::ComboBox> m_process_combo;
};
}

View file

@ -18,6 +18,8 @@
#include <LibELF/Image.h>
#include <sys/stat.h>
namespace Profiler {
static void sort_profile_nodes(Vector<NonnullRefPtr<ProfileNode>>& nodes)
{
quick_sort(nodes.begin(), nodes.end(), [](auto& a, auto& b) {
@ -459,3 +461,5 @@ const Process* ProfileNode::process(Profile& profile, u64 timestamp) const
{
return profile.find_process(m_pid, timestamp);
}
}

View file

@ -20,6 +20,8 @@
#include <LibGUI/Forward.h>
#include <LibGUI/ModelIndex.h>
namespace Profiler {
class DisassemblyModel;
class Profile;
class ProfileModel;
@ -229,3 +231,5 @@ private:
bool m_show_top_functions { false };
bool m_show_percentages { false };
};
}

View file

@ -10,6 +10,8 @@
#include <ctype.h>
#include <stdio.h>
namespace Profiler {
ProfileModel::ProfileModel(Profile& profile)
: m_profile(profile)
{
@ -129,3 +131,5 @@ void ProfileModel::update()
{
did_update(Model::InvalidateAllIndices);
}
}

View file

@ -8,6 +8,8 @@
#include <LibGUI/Model.h>
namespace Profiler {
class Profile;
class ProfileModel final : public GUI::Model {
@ -44,3 +46,5 @@ private:
GUI::Icon m_user_frame_icon;
GUI::Icon m_kernel_frame_icon;
};
}

View file

@ -9,6 +9,8 @@
#include <LibGUI/Painter.h>
#include <LibGfx/Font.h>
namespace Profiler {
ProfileTimelineWidget::ProfileTimelineWidget(Profile& profile)
: m_profile(profile)
{
@ -121,3 +123,5 @@ void ProfileTimelineWidget::mouseup_event(GUI::MouseEvent& event)
if (m_select_start_time == m_select_end_time)
m_profile.clear_timestamp_filter_range();
}
}

View file

@ -8,6 +8,8 @@
#include <LibGUI/Frame.h>
namespace Profiler {
class Profile;
class ProfileTimelineWidget final : public GUI::Frame {
@ -32,3 +34,5 @@ private:
u64 m_select_end_time { 0 };
u64 m_hover_time { 0 };
};
}

View file

@ -9,6 +9,8 @@
#include <AK/StringBuilder.h>
#include <stdio.h>
namespace Profiler {
SamplesModel::SamplesModel(Profile& profile)
: m_profile(profile)
{
@ -91,3 +93,5 @@ void SamplesModel::update()
{
did_update(Model::InvalidateAllIndices);
}
}

View file

@ -8,6 +8,8 @@
#include <LibGUI/Model.h>
namespace Profiler {
class Profile;
class SamplesModel final : public GUI::Model {
@ -43,3 +45,5 @@ private:
GUI::Icon m_user_frame_icon;
GUI::Icon m_kernel_frame_icon;
};
}

View file

@ -32,6 +32,8 @@
#include <serenity.h>
#include <string.h>
using namespace Profiler;
static bool generate_profile(pid_t& pid);
int main(int argc, char** argv)