Skip to content

Commit

Permalink
Profiler: Move everything into the "Profiler" namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed May 4, 2021
1 parent d29e2dd commit dbbc609
Show file tree
Hide file tree
Showing 17 changed files with 66 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/DisassemblyModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <ctype.h>
#include <stdio.h>

namespace Profiler {

static const Gfx::Bitmap& heat_gradient()
{
static RefPtr<Gfx::Bitmap> bitmap;
Expand Down Expand Up @@ -185,3 +187,5 @@ void DisassemblyModel::update()
{
did_update();
}

}
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/DisassemblyModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <LibGUI/Model.h>
#include <LibX86/Instruction.h>

namespace Profiler {

class Profile;
class ProfileNode;

Expand Down Expand Up @@ -53,3 +55,5 @@ class DisassemblyModel final : public GUI::Model {

Vector<InstructionData> m_instructions;
};

}
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/IndividualSampleModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -69,3 +71,5 @@ void IndividualSampleModel::update()
{
did_update(Model::InvalidateAllIndices);
}

}
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/IndividualSampleModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include <LibGUI/Model.h>

namespace Profiler {

class Profile;

class IndividualSampleModel final : public GUI::Model {
Expand Down Expand Up @@ -38,3 +40,5 @@ class IndividualSampleModel final : public GUI::Model {
Profile& m_profile;
const size_t m_event_index { 0 };
};

}
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include "Process.h"

namespace Profiler {

Thread* Process::find_thread(pid_t tid, u64 timestamp)
{
auto it = threads.find(tid);
Expand Down Expand Up @@ -115,3 +117,5 @@ const LibraryMetadata::Library* LibraryMetadata::library_containing(FlatPtr ptr)
}
return nullptr;
}

}
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/Process.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <AK/Vector.h>
#include <LibELF/Image.h>

namespace Profiler {

struct MappedObject {
NonnullRefPtr<MappedFile> file;
ELF::Image elf;
Expand Down Expand Up @@ -66,3 +68,5 @@ struct Process {
return timestamp >= start_valid && (end_valid == 0 || timestamp <= end_valid);
}
};

}
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/ProcessPickerWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <LibGUI/ItemListModel.h>
#include <LibGUI/Label.h>

namespace Profiler {

ProcessPickerWidget::ProcessPickerWidget(Profile& profile)
: m_profile(profile)
{
Expand Down Expand Up @@ -46,3 +48,5 @@ ProcessPickerWidget::ProcessPickerWidget(Profile& profile)
ProcessPickerWidget::~ProcessPickerWidget()
{
}

}
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/ProcessPickerWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <LibGUI/ComboBox.h>
#include <LibGUI/Frame.h>

namespace Profiler {

class Profile;

class ProcessPickerWidget final : public GUI::Frame {
Expand All @@ -29,3 +31,5 @@ class ProcessPickerWidget final : public GUI::Frame {

RefPtr<GUI::ComboBox> m_process_combo;
};

}
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -459,3 +461,5 @@ const Process* ProfileNode::process(Profile& profile, u64 timestamp) const
{
return profile.find_process(m_pid, timestamp);
}

}
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/Profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <LibGUI/Forward.h>
#include <LibGUI/ModelIndex.h>

namespace Profiler {

class DisassemblyModel;
class Profile;
class ProfileModel;
Expand Down Expand Up @@ -229,3 +231,5 @@ class Profile {
bool m_show_top_functions { false };
bool m_show_percentages { false };
};

}
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/ProfileModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <ctype.h>
#include <stdio.h>

namespace Profiler {

ProfileModel::ProfileModel(Profile& profile)
: m_profile(profile)
{
Expand Down Expand Up @@ -129,3 +131,5 @@ void ProfileModel::update()
{
did_update(Model::InvalidateAllIndices);
}

}
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/ProfileModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include <LibGUI/Model.h>

namespace Profiler {

class Profile;

class ProfileModel final : public GUI::Model {
Expand Down Expand Up @@ -44,3 +46,5 @@ class ProfileModel final : public GUI::Model {
GUI::Icon m_user_frame_icon;
GUI::Icon m_kernel_frame_icon;
};

}
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/ProfileTimelineWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <LibGUI/Painter.h>
#include <LibGfx/Font.h>

namespace Profiler {

ProfileTimelineWidget::ProfileTimelineWidget(Profile& profile)
: m_profile(profile)
{
Expand Down Expand Up @@ -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();
}

}
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/ProfileTimelineWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include <LibGUI/Frame.h>

namespace Profiler {

class Profile;

class ProfileTimelineWidget final : public GUI::Frame {
Expand All @@ -32,3 +34,5 @@ class ProfileTimelineWidget final : public GUI::Frame {
u64 m_select_end_time { 0 };
u64 m_hover_time { 0 };
};

}
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/SamplesModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <AK/StringBuilder.h>
#include <stdio.h>

namespace Profiler {

SamplesModel::SamplesModel(Profile& profile)
: m_profile(profile)
{
Expand Down Expand Up @@ -91,3 +93,5 @@ void SamplesModel::update()
{
did_update(Model::InvalidateAllIndices);
}

}
4 changes: 4 additions & 0 deletions Userland/DevTools/Profiler/SamplesModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include <LibGUI/Model.h>

namespace Profiler {

class Profile;

class SamplesModel final : public GUI::Model {
Expand Down Expand Up @@ -43,3 +45,5 @@ class SamplesModel final : public GUI::Model {
GUI::Icon m_user_frame_icon;
GUI::Icon m_kernel_frame_icon;
};

}
2 changes: 2 additions & 0 deletions Userland/DevTools/Profiler/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit dbbc609

Please sign in to comment.