1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 08:27:45 +00:00

Profiler: Make everything east-const :^)

This commit is contained in:
Stephan Unverwerth 2021-12-28 13:35:08 +01:00 committed by Andreas Kling
parent cf8427b7b4
commit ddccf451a9
16 changed files with 68 additions and 68 deletions

View file

@ -17,7 +17,7 @@
namespace Profiler { namespace Profiler {
static const Gfx::Bitmap& heat_gradient() static Gfx::Bitmap const& heat_gradient()
{ {
static RefPtr<Gfx::Bitmap> bitmap; static RefPtr<Gfx::Bitmap> bitmap;
if (!bitmap) { if (!bitmap) {
@ -54,8 +54,8 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node)
, m_node(node) , m_node(node)
{ {
FlatPtr base_address = 0; FlatPtr base_address = 0;
const Debug::DebugInfo* debug_info; Debug::DebugInfo const* debug_info;
const ELF::Image* elf; ELF::Image const* elf;
if (auto maybe_kernel_base = Symbolication::kernel_base(); maybe_kernel_base.has_value() && m_node.address() >= *maybe_kernel_base) { if (auto maybe_kernel_base = Symbolication::kernel_base(); maybe_kernel_base.has_value() && m_node.address() >= *maybe_kernel_base) {
if (!g_kernel_debuginfo_object.has_value()) if (!g_kernel_debuginfo_object.has_value())
return; return;
@ -107,7 +107,7 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node)
auto view = symbol.value().raw_data().substring_view(symbol_offset_from_function_start); auto view = symbol.value().raw_data().substring_view(symbol_offset_from_function_start);
X86::ELFSymbolProvider symbol_provider(*elf, base_address); X86::ELFSymbolProvider symbol_provider(*elf, base_address);
X86::SimpleInstructionStream stream((const u8*)view.characters_without_null_termination(), view.length()); X86::SimpleInstructionStream stream((u8 const*)view.characters_without_null_termination(), view.length());
X86::Disassembler disassembler(stream); X86::Disassembler disassembler(stream);
size_t offset_into_symbol = 0; size_t offset_into_symbol = 0;
@ -143,7 +143,7 @@ DisassemblyModel::~DisassemblyModel()
{ {
} }
int DisassemblyModel::row_count(const GUI::ModelIndex&) const int DisassemblyModel::row_count(GUI::ModelIndex const&) const
{ {
return m_instructions.size(); return m_instructions.size();
} }
@ -172,7 +172,7 @@ struct ColorPair {
Color foreground; Color foreground;
}; };
static Optional<ColorPair> color_pair_for(const InstructionData& insn) static Optional<ColorPair> color_pair_for(InstructionData const& insn)
{ {
if (insn.percent == 0) if (insn.percent == 0)
return {}; return {};
@ -186,7 +186,7 @@ static Optional<ColorPair> color_pair_for(const InstructionData& insn)
return ColorPair { background, foreground }; return ColorPair { background, foreground };
} }
GUI::Variant DisassemblyModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const GUI::Variant DisassemblyModel::data(GUI::ModelIndex const& index, GUI::ModelRole role) const
{ {
auto const& insn = m_instructions[index.row()]; auto const& insn = m_instructions[index.row()];

View file

@ -43,10 +43,10 @@ public:
virtual ~DisassemblyModel() override; virtual ~DisassemblyModel() override;
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; }
virtual String column_name(int) const override; virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
virtual bool is_column_sortable(int) const override { return false; } virtual bool is_column_sortable(int) const override { return false; }
private: private:

View file

@ -123,7 +123,7 @@ void FlameGraphView::paint_event(GUI::PaintEvent& event)
GUI::Painter painter(*this); GUI::Painter painter(*this);
painter.add_clip_rect(event.rect()); painter.add_clip_rect(event.rect());
for (const auto& bar : m_bars) { for (auto const& bar : m_bars) {
auto label = bar_label(bar); auto label = bar_label(bar);
auto color = m_colors[label.hash() % m_colors.size()]; auto color = m_colors[label.hash() % m_colors.size()];

View file

@ -21,13 +21,13 @@ IndividualSampleModel::~IndividualSampleModel()
{ {
} }
int IndividualSampleModel::row_count(const GUI::ModelIndex&) const int IndividualSampleModel::row_count(GUI::ModelIndex const&) const
{ {
auto const& event = m_profile.events().at(m_event_index); auto const& event = m_profile.events().at(m_event_index);
return event.frames.size(); return event.frames.size();
} }
int IndividualSampleModel::column_count(const GUI::ModelIndex&) const int IndividualSampleModel::column_count(GUI::ModelIndex const&) const
{ {
return Column::__Count; return Column::__Count;
} }
@ -46,7 +46,7 @@ String IndividualSampleModel::column_name(int column) const
} }
} }
GUI::Variant IndividualSampleModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const GUI::Variant IndividualSampleModel::data(GUI::ModelIndex const& index, GUI::ModelRole role) const
{ {
auto const& event = m_profile.events().at(m_event_index); auto const& event = m_profile.events().at(m_event_index);
auto const& frame = event.frames[event.frames.size() - index.row() - 1]; auto const& frame = event.frames[event.frames.size() - index.row() - 1];

View file

@ -28,16 +28,16 @@ public:
virtual ~IndividualSampleModel() override; virtual ~IndividualSampleModel() override;
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
virtual String column_name(int) const override; virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
private: private:
IndividualSampleModel(Profile&, size_t event_index); IndividualSampleModel(Profile&, size_t event_index);
Profile& m_profile; Profile& m_profile;
const size_t m_event_index { 0 }; size_t const m_event_index { 0 };
}; };
} }

View file

@ -43,7 +43,7 @@ void Process::handle_thread_exit(pid_t tid, EventSerialNumber serial)
HashMap<String, OwnPtr<MappedObject>> g_mapped_object_cache; HashMap<String, OwnPtr<MappedObject>> g_mapped_object_cache;
static MappedObject* get_or_create_mapped_object(const String& path) static MappedObject* get_or_create_mapped_object(String const& path)
{ {
if (auto it = g_mapped_object_cache.find(path); it != g_mapped_object_cache.end()) if (auto it = g_mapped_object_cache.find(path); it != g_mapped_object_cache.end())
return it->value.ptr(); return it->value.ptr();
@ -67,7 +67,7 @@ static MappedObject* get_or_create_mapped_object(const String& path)
return ptr; return ptr;
} }
void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, const String& name) void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, String const& name)
{ {
StringView path; StringView path;
if (name.contains("Loader.so"sv)) if (name.contains("Loader.so"sv))
@ -107,7 +107,7 @@ void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, const String& name)
} }
} }
const Debug::DebugInfo& LibraryMetadata::Library::load_debug_info(FlatPtr base_address) const Debug::DebugInfo const& LibraryMetadata::Library::load_debug_info(FlatPtr base_address) const
{ {
if (debug_info == nullptr) if (debug_info == nullptr)
debug_info = make<Debug::DebugInfo>(object->elf, String::empty(), base_address); debug_info = make<Debug::DebugInfo>(object->elf, String::empty(), base_address);
@ -122,7 +122,7 @@ String LibraryMetadata::Library::symbolicate(FlatPtr ptr, u32* offset) const
return object->elf.symbolicate(ptr - base, offset); return object->elf.symbolicate(ptr - base, offset);
} }
const LibraryMetadata::Library* LibraryMetadata::library_containing(FlatPtr ptr) const LibraryMetadata::Library const* LibraryMetadata::library_containing(FlatPtr ptr) const
{ {
for (auto& it : m_libraries) { for (auto& it : m_libraries) {
auto& library = *it.value; auto& library = *it.value;

View file

@ -34,11 +34,11 @@ public:
mutable OwnPtr<Debug::DebugInfo> debug_info; mutable OwnPtr<Debug::DebugInfo> debug_info;
String symbolicate(FlatPtr, u32* offset) const; String symbolicate(FlatPtr, u32* offset) const;
const Debug::DebugInfo& load_debug_info(FlatPtr base_address) const; Debug::DebugInfo const& load_debug_info(FlatPtr base_address) const;
}; };
void handle_mmap(FlatPtr base, size_t size, const String& name); void handle_mmap(FlatPtr base, size_t size, String const& name);
const Library* library_containing(FlatPtr) const; Library const* library_containing(FlatPtr) const;
private: private:
mutable HashMap<String, NonnullOwnPtr<Library>> m_libraries; mutable HashMap<String, NonnullOwnPtr<Library>> m_libraries;

View file

@ -145,7 +145,7 @@ void Profile::rebuild_tree()
ProfileNode* node = nullptr; ProfileNode* node = nullptr;
auto& process_node = find_or_create_process_node(event.pid, event.serial); auto& process_node = find_or_create_process_node(event.pid, event.serial);
process_node.increment_event_count(); process_node.increment_event_count();
for_each_frame([&](const Frame& frame, bool is_innermost_frame) { for_each_frame([&](Frame const& frame, bool is_innermost_frame) {
auto const& object_name = frame.object_name; auto const& object_name = frame.object_name;
auto const& symbol = frame.symbol; auto const& symbol = frame.symbol;
auto const& address = frame.address; auto const& address = frame.address;
@ -538,7 +538,7 @@ void Profile::set_show_percentages(bool show_percentages)
m_show_percentages = show_percentages; m_show_percentages = show_percentages;
} }
void Profile::set_disassembly_index(const GUI::ModelIndex& index) void Profile::set_disassembly_index(GUI::ModelIndex const& index)
{ {
if (m_disassembly_index == index) if (m_disassembly_index == index)
return; return;

View file

@ -52,8 +52,8 @@ public:
bool has_seen_event(size_t event_index) const { return m_seen_events.get(event_index); } bool has_seen_event(size_t event_index) const { return m_seen_events.get(event_index); }
void did_see_event(size_t event_index) { m_seen_events.set(event_index, true); } void did_see_event(size_t event_index) { m_seen_events.set(event_index, true); }
const FlyString& object_name() const { return m_object_name; } FlyString const& object_name() const { return m_object_name; }
const String& symbol() const { return m_symbol; } String const& symbol() const { return m_symbol; }
FlatPtr address() const { return m_address; } FlatPtr address() const { return m_address; }
u32 offset() const { return m_offset; } u32 offset() const { return m_offset; }
u64 timestamp() const { return m_timestamp; } u64 timestamp() const { return m_timestamp; }
@ -62,7 +62,7 @@ public:
u32 self_count() const { return m_self_count; } u32 self_count() const { return m_self_count; }
int child_count() const { return m_children.size(); } int child_count() const { return m_children.size(); }
const Vector<NonnullRefPtr<ProfileNode>>& children() const { return m_children; } Vector<NonnullRefPtr<ProfileNode>> const& children() const { return m_children; }
void add_child(ProfileNode& child) void add_child(ProfileNode& child)
{ {
@ -87,14 +87,14 @@ public:
}; };
ProfileNode* parent() { return m_parent; } ProfileNode* parent() { return m_parent; }
const ProfileNode* parent() const { return m_parent; } ProfileNode const* parent() const { return m_parent; }
void increment_event_count() { ++m_event_count; } void increment_event_count() { ++m_event_count; }
void increment_self_count() { ++m_self_count; } void increment_self_count() { ++m_self_count; }
void sort_children(); void sort_children();
const HashMap<FlatPtr, size_t>& events_per_address() const { return m_events_per_address; } HashMap<FlatPtr, size_t> const& events_per_address() const { return m_events_per_address; }
void add_event_address(FlatPtr address) void add_event_address(FlatPtr address)
{ {
auto it = m_events_per_address.find(address); auto it = m_events_per_address.find(address);
@ -150,7 +150,7 @@ public:
GUI::Model* disassembly_model(); GUI::Model* disassembly_model();
GUI::Model* source_model(); GUI::Model* source_model();
const Process* find_process(pid_t pid, EventSerialNumber serial) const Process const* find_process(pid_t pid, EventSerialNumber serial) const
{ {
auto it = m_processes.find_if([&pid, &serial](auto& entry) { auto it = m_processes.find_if([&pid, &serial](auto& entry) {
return entry.pid == pid && entry.valid_at(serial); return entry.pid == pid && entry.valid_at(serial);
@ -158,10 +158,10 @@ public:
return it.is_end() ? nullptr : &(*it); return it.is_end() ? nullptr : &(*it);
} }
void set_disassembly_index(const GUI::ModelIndex&); void set_disassembly_index(GUI::ModelIndex const&);
void set_source_index(const GUI::ModelIndex&); void set_source_index(GUI::ModelIndex const&);
const Vector<NonnullRefPtr<ProfileNode>>& roots() const { return m_roots; } Vector<NonnullRefPtr<ProfileNode>> const& roots() const { return m_roots; }
struct Frame { struct Frame {
FlyString object_name; FlyString object_name;
@ -225,8 +225,8 @@ public:
}; };
Vector<Event> const& events() const { return m_events; } Vector<Event> const& events() const { return m_events; }
const Vector<size_t>& filtered_event_indices() const { return m_filtered_event_indices; } Vector<size_t> const& filtered_event_indices() const { return m_filtered_event_indices; }
const Vector<size_t>& filtered_signpost_indices() const { return m_filtered_signpost_indices; } Vector<size_t> const& filtered_signpost_indices() const { return m_filtered_signpost_indices; }
u64 length_in_ms() const { return m_last_timestamp - m_first_timestamp; } u64 length_in_ms() const { return m_last_timestamp - m_first_timestamp; }
u64 first_timestamp() const { return m_first_timestamp; } u64 first_timestamp() const { return m_first_timestamp; }
@ -250,7 +250,7 @@ public:
bool show_percentages() const { return m_show_percentages; } bool show_percentages() const { return m_show_percentages; }
void set_show_percentages(bool); void set_show_percentages(bool);
const Vector<Process>& processes() const { return m_processes; } Vector<Process> const& processes() const { return m_processes; }
template<typename Callback> template<typename Callback>
void for_each_event_in_filter_range(Callback callback) void for_each_event_in_filter_range(Callback callback)

View file

@ -23,7 +23,7 @@ ProfileModel::~ProfileModel()
{ {
} }
GUI::ModelIndex ProfileModel::index(int row, int column, const GUI::ModelIndex& parent) const GUI::ModelIndex ProfileModel::index(int row, int column, GUI::ModelIndex const& parent) const
{ {
if (!parent.is_valid()) { if (!parent.is_valid()) {
if (m_profile.roots().is_empty()) if (m_profile.roots().is_empty())
@ -34,7 +34,7 @@ GUI::ModelIndex ProfileModel::index(int row, int column, const GUI::ModelIndex&
return create_index(row, column, remote_parent.children().at(row).ptr()); return create_index(row, column, remote_parent.children().at(row).ptr());
} }
GUI::ModelIndex ProfileModel::parent_index(const GUI::ModelIndex& index) const GUI::ModelIndex ProfileModel::parent_index(GUI::ModelIndex const& index) const
{ {
if (!index.is_valid()) if (!index.is_valid())
return {}; return {};
@ -62,7 +62,7 @@ GUI::ModelIndex ProfileModel::parent_index(const GUI::ModelIndex& index) const
return {}; return {};
} }
int ProfileModel::row_count(const GUI::ModelIndex& index) const int ProfileModel::row_count(GUI::ModelIndex const& index) const
{ {
if (!index.is_valid()) if (!index.is_valid())
return m_profile.roots().size(); return m_profile.roots().size();
@ -70,7 +70,7 @@ int ProfileModel::row_count(const GUI::ModelIndex& index) const
return node.children().size(); return node.children().size();
} }
int ProfileModel::column_count(const GUI::ModelIndex&) const int ProfileModel::column_count(GUI::ModelIndex const&) const
{ {
return Column::__Count; return Column::__Count;
} }
@ -94,7 +94,7 @@ String ProfileModel::column_name(int column) const
} }
} }
GUI::Variant ProfileModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const GUI::Variant ProfileModel::data(GUI::ModelIndex const& index, GUI::ModelRole role) const
{ {
auto* node = static_cast<ProfileNode*>(index.internal_data()); auto* node = static_cast<ProfileNode*>(index.internal_data());
if (role == GUI::ModelRole::TextAlignment) { if (role == GUI::ModelRole::TextAlignment) {

View file

@ -30,12 +30,12 @@ public:
virtual ~ProfileModel() override; virtual ~ProfileModel() override;
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
virtual String column_name(int) const override; virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override; virtual GUI::ModelIndex index(int row, int column, GUI::ModelIndex const& parent = GUI::ModelIndex()) const override;
virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override; virtual GUI::ModelIndex parent_index(GUI::ModelIndex const&) const override;
virtual int tree_column() const override { return Column::StackFrame; } virtual int tree_column() const override { return Column::StackFrame; }
virtual bool is_column_sortable(int) const override { return false; } virtual bool is_column_sortable(int) const override { return false; }
virtual bool is_searchable() const override { return true; } virtual bool is_searchable() const override { return true; }

View file

@ -21,12 +21,12 @@ SamplesModel::~SamplesModel()
{ {
} }
int SamplesModel::row_count(const GUI::ModelIndex&) const int SamplesModel::row_count(GUI::ModelIndex const&) const
{ {
return m_profile.filtered_event_indices().size(); return m_profile.filtered_event_indices().size();
} }
int SamplesModel::column_count(const GUI::ModelIndex&) const int SamplesModel::column_count(GUI::ModelIndex const&) const
{ {
return Column::__Count; return Column::__Count;
} }
@ -53,7 +53,7 @@ String SamplesModel::column_name(int column) const
} }
} }
GUI::Variant SamplesModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const GUI::Variant SamplesModel::data(GUI::ModelIndex const& index, GUI::ModelRole role) const
{ {
u32 event_index = m_profile.filtered_event_indices()[index.row()]; u32 event_index = m_profile.filtered_event_indices()[index.row()];
auto const& event = m_profile.events().at(event_index); auto const& event = m_profile.events().at(event_index);

View file

@ -32,10 +32,10 @@ public:
virtual ~SamplesModel() override; virtual ~SamplesModel() override;
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
virtual String column_name(int) const override; virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
virtual bool is_column_sortable(int) const override { return false; } virtual bool is_column_sortable(int) const override { return false; }
private: private:

View file

@ -19,12 +19,12 @@ SignpostsModel::~SignpostsModel()
{ {
} }
int SignpostsModel::row_count(const GUI::ModelIndex&) const int SignpostsModel::row_count(GUI::ModelIndex const&) const
{ {
return m_profile.filtered_signpost_indices().size(); return m_profile.filtered_signpost_indices().size();
} }
int SignpostsModel::column_count(const GUI::ModelIndex&) const int SignpostsModel::column_count(GUI::ModelIndex const&) const
{ {
return Column::__Count; return Column::__Count;
} }
@ -51,7 +51,7 @@ String SignpostsModel::column_name(int column) const
} }
} }
GUI::Variant SignpostsModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const GUI::Variant SignpostsModel::data(GUI::ModelIndex const& index, GUI::ModelRole role) const
{ {
u32 event_index = m_profile.filtered_signpost_indices()[index.row()]; u32 event_index = m_profile.filtered_signpost_indices()[index.row()];
auto const& event = m_profile.events().at(event_index); auto const& event = m_profile.events().at(event_index);

View file

@ -32,10 +32,10 @@ public:
virtual ~SignpostsModel() override; virtual ~SignpostsModel() override;
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
virtual String column_name(int) const override; virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
virtual bool is_column_sortable(int) const override { return false; } virtual bool is_column_sortable(int) const override { return false; }
private: private:

View file

@ -46,7 +46,7 @@ static bool generate_profile(pid_t& pid);
ErrorOr<int> serenity_main(Main::Arguments arguments) ErrorOr<int> serenity_main(Main::Arguments arguments)
{ {
int pid = 0; int pid = 0;
const char* perfcore_file_arg = nullptr; char const* perfcore_file_arg = nullptr;
Core::ArgsParser args_parser; Core::ArgsParser args_parser;
args_parser.add_option(pid, "PID to profile", "pid", 'p', "PID"); args_parser.add_option(pid, "PID to profile", "pid", 'p', "PID");
args_parser.add_positional_argument(perfcore_file_arg, "Path of perfcore file", "perfcore-file", Core::ArgsParser::Required::No); args_parser.add_positional_argument(perfcore_file_arg, "Path of perfcore file", "perfcore-file", Core::ArgsParser::Required::No);
@ -190,7 +190,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto individual_sample_view = TRY(samples_splitter->try_add<GUI::TableView>()); auto individual_sample_view = TRY(samples_splitter->try_add<GUI::TableView>());
samples_table_view->on_selection_change = [&] { samples_table_view->on_selection_change = [&] {
const auto& index = samples_table_view->selection().first(); auto const& index = samples_table_view->selection().first();
auto model = IndividualSampleModel::create(*profile, index.data(GUI::ModelRole::Custom).to_integer<size_t>()); auto model = IndividualSampleModel::create(*profile, index.data(GUI::ModelRole::Custom).to_integer<size_t>());
individual_sample_view->set_model(move(model)); individual_sample_view->set_model(move(model));
}; };
@ -205,7 +205,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto individual_signpost_view = TRY(signposts_splitter->try_add<GUI::TableView>()); auto individual_signpost_view = TRY(signposts_splitter->try_add<GUI::TableView>());
signposts_table_view->on_selection_change = [&] { signposts_table_view->on_selection_change = [&] {
const auto& index = signposts_table_view->selection().first(); auto const& index = signposts_table_view->selection().first();
auto model = IndividualSampleModel::create(*profile, index.data(GUI::ModelRole::Custom).to_integer<size_t>()); auto model = IndividualSampleModel::create(*profile, index.data(GUI::ModelRole::Custom).to_integer<size_t>());
individual_signpost_view->set_model(move(model)); individual_signpost_view->set_model(move(model));
}; };
@ -216,9 +216,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto flamegraph_view = TRY(flamegraph_tab->try_add<FlameGraphView>(profile->model(), ProfileModel::Column::StackFrame, ProfileModel::Column::SampleCount)); auto flamegraph_view = TRY(flamegraph_tab->try_add<FlameGraphView>(profile->model(), ProfileModel::Column::StackFrame, ProfileModel::Column::SampleCount));
const u64 start_of_trace = profile->first_timestamp(); u64 const start_of_trace = profile->first_timestamp();
const u64 end_of_trace = start_of_trace + profile->length_in_ms(); u64 const end_of_trace = start_of_trace + profile->length_in_ms();
const auto clamp_timestamp = [start_of_trace, end_of_trace](u64 timestamp) -> u64 { auto const clamp_timestamp = [start_of_trace, end_of_trace](u64 timestamp) -> u64 {
return min(end_of_trace, max(timestamp, start_of_trace)); return min(end_of_trace, max(timestamp, start_of_trace));
}; };
@ -291,7 +291,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return app->exec(); return app->exec();
} }
static bool prompt_to_stop_profiling(pid_t pid, const String& process_name) static bool prompt_to_stop_profiling(pid_t pid, String const& process_name)
{ {
auto window = GUI::Window::construct(); auto window = GUI::Window::construct();
window->set_title(String::formatted("Profiling {}({})", process_name, pid)); window->set_title(String::formatted("Profiling {}({})", process_name, pid));