mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:47:36 +00:00
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -48,7 +48,7 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node)
|
|||
if (elf == nullptr)
|
||||
return;
|
||||
if (g_kernel_debug_info == nullptr)
|
||||
g_kernel_debug_info = make<Debug::DebugInfo>(g_kernel_debuginfo_object->elf, String::empty(), base_address);
|
||||
g_kernel_debug_info = make<Debug::DebugInfo>(g_kernel_debuginfo_object->elf, DeprecatedString::empty(), base_address);
|
||||
debug_info = g_kernel_debug_info.ptr();
|
||||
} else {
|
||||
auto const& process = node.process();
|
||||
|
@ -128,7 +128,7 @@ int DisassemblyModel::row_count(GUI::ModelIndex const&) const
|
|||
return m_instructions.size();
|
||||
}
|
||||
|
||||
String DisassemblyModel::column_name(int column) const
|
||||
DeprecatedString DisassemblyModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::SampleCount:
|
||||
|
@ -192,7 +192,7 @@ GUI::Variant DisassemblyModel::data(GUI::ModelIndex const& index, GUI::ModelRole
|
|||
}
|
||||
|
||||
if (index.column() == Column::Address)
|
||||
return String::formatted("{:p}", insn.address);
|
||||
return DeprecatedString::formatted("{:p}", insn.address);
|
||||
|
||||
if (index.column() == Column::InstructionBytes) {
|
||||
StringBuilder builder;
|
||||
|
|
|
@ -18,7 +18,7 @@ class ProfileNode;
|
|||
|
||||
struct InstructionData {
|
||||
X86::Instruction insn;
|
||||
String disassembly;
|
||||
DeprecatedString disassembly;
|
||||
StringView bytes;
|
||||
FlatPtr address { 0 };
|
||||
u32 event_count { 0 };
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
||||
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; }
|
||||
virtual String column_name(int) const override;
|
||||
virtual DeprecatedString column_name(int) const override;
|
||||
virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
|
||||
virtual bool is_column_sortable(int) const override { return false; }
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ FileEventModel::~FileEventModel()
|
|||
{
|
||||
}
|
||||
|
||||
FileEventNode& FileEventNode::find_or_create_node(String const& searched_path)
|
||||
FileEventNode& FileEventNode::find_or_create_node(DeprecatedString const& searched_path)
|
||||
{
|
||||
// TODO: Optimize this function.
|
||||
|
||||
|
@ -61,7 +61,7 @@ FileEventNode& FileEventNode::find_or_create_node(String const& searched_path)
|
|||
}
|
||||
}
|
||||
|
||||
FileEventNode& FileEventNode::create_recursively(String new_path)
|
||||
FileEventNode& FileEventNode::create_recursively(DeprecatedString new_path)
|
||||
{
|
||||
auto const lex_path = LexicalPath(new_path);
|
||||
auto parts = lex_path.parts();
|
||||
|
@ -142,7 +142,7 @@ int FileEventModel::column_count(GUI::ModelIndex const&) const
|
|||
return Column::__Count;
|
||||
}
|
||||
|
||||
String FileEventModel::column_name(int column) const
|
||||
DeprecatedString FileEventModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::Path:
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibGUI/Model.h>
|
||||
|
||||
namespace Profiler {
|
||||
|
@ -17,23 +17,23 @@ class Profile;
|
|||
|
||||
class FileEventNode : public RefCounted<FileEventNode> {
|
||||
public:
|
||||
static NonnullRefPtr<FileEventNode> create(String const& path, FileEventNode* parent = nullptr)
|
||||
static NonnullRefPtr<FileEventNode> create(DeprecatedString const& path, FileEventNode* parent = nullptr)
|
||||
{
|
||||
return adopt_ref(*new FileEventNode(path, parent));
|
||||
}
|
||||
|
||||
FileEventNode& find_or_create_node(String const&);
|
||||
FileEventNode& find_or_create_node(DeprecatedString const&);
|
||||
|
||||
Vector<NonnullRefPtr<FileEventNode>>& children() { return m_children; }
|
||||
Vector<NonnullRefPtr<FileEventNode>> const& children() const { return m_children; }
|
||||
|
||||
FileEventNode* parent() { return m_parent; };
|
||||
|
||||
FileEventNode& create_recursively(String);
|
||||
FileEventNode& create_recursively(DeprecatedString);
|
||||
|
||||
void for_each_parent_node(Function<void(FileEventNode&)> callback);
|
||||
|
||||
String const& path() const { return m_path; }
|
||||
DeprecatedString const& path() const { return m_path; }
|
||||
|
||||
void increment_count() { m_count++; }
|
||||
u64 count() const { return m_count; }
|
||||
|
@ -42,13 +42,13 @@ public:
|
|||
u64 duration() const { return m_duration; }
|
||||
|
||||
private:
|
||||
FileEventNode(String const& path, FileEventNode* parent = nullptr)
|
||||
FileEventNode(DeprecatedString const& path, FileEventNode* parent = nullptr)
|
||||
: m_path(path)
|
||||
, m_count(0)
|
||||
, m_duration(0)
|
||||
, m_parent(parent) {};
|
||||
|
||||
String m_path;
|
||||
DeprecatedString m_path;
|
||||
u64 m_count;
|
||||
u64 m_duration;
|
||||
|
||||
|
@ -74,7 +74,7 @@ public:
|
|||
|
||||
virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
||||
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
||||
virtual String column_name(int) const override;
|
||||
virtual DeprecatedString column_name(int) const override;
|
||||
virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
|
||||
virtual GUI::ModelIndex index(int row, int column, GUI::ModelIndex const& parent = GUI::ModelIndex()) const override;
|
||||
virtual GUI::ModelIndex parent_index(GUI::ModelIndex const&) const override;
|
||||
|
|
|
@ -89,7 +89,7 @@ void FlameGraphView::mousemove_event(GUI::MouseEvent& event)
|
|||
if (on_hover_change)
|
||||
on_hover_change();
|
||||
|
||||
String label = "";
|
||||
DeprecatedString label = "";
|
||||
if (m_hovered_bar != nullptr && m_hovered_bar->index.is_valid()) {
|
||||
label = bar_label(*m_hovered_bar);
|
||||
}
|
||||
|
@ -175,10 +175,10 @@ void FlameGraphView::paint_event(GUI::PaintEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
String FlameGraphView::bar_label(StackBar const& bar) const
|
||||
DeprecatedString FlameGraphView::bar_label(StackBar const& bar) const
|
||||
{
|
||||
auto label_index = bar.index.sibling_at_column(m_text_column);
|
||||
String label = "All";
|
||||
DeprecatedString label = "All";
|
||||
if (label_index.is_valid()) {
|
||||
label = m_model.data(label_index).to_string();
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ private:
|
|||
bool selected;
|
||||
};
|
||||
|
||||
String bar_label(StackBar const&) const;
|
||||
DeprecatedString bar_label(StackBar const&) const;
|
||||
void layout_bars();
|
||||
void layout_children(GUI::ModelIndex& parent, int depth, int left, int right, Vector<GUI::ModelIndex>& selected);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ int IndividualSampleModel::column_count(GUI::ModelIndex const&) const
|
|||
return Column::__Count;
|
||||
}
|
||||
|
||||
String IndividualSampleModel::column_name(int column) const
|
||||
DeprecatedString IndividualSampleModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::Address:
|
||||
|
@ -50,7 +50,7 @@ GUI::Variant IndividualSampleModel::data(GUI::ModelIndex const& index, GUI::Mode
|
|||
|
||||
if (role == GUI::ModelRole::Display) {
|
||||
if (index.column() == Column::Address)
|
||||
return String::formatted("{:p}", frame.address);
|
||||
return DeprecatedString::formatted("{:p}", frame.address);
|
||||
|
||||
if (index.column() == Column::Symbol) {
|
||||
return frame.symbol;
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
||||
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
||||
virtual String column_name(int) const override;
|
||||
virtual DeprecatedString column_name(int) const override;
|
||||
virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -41,9 +41,9 @@ void Process::handle_thread_exit(pid_t tid, EventSerialNumber serial)
|
|||
thread->end_valid = serial;
|
||||
}
|
||||
|
||||
HashMap<String, OwnPtr<MappedObject>> g_mapped_object_cache;
|
||||
HashMap<DeprecatedString, OwnPtr<MappedObject>> g_mapped_object_cache;
|
||||
|
||||
static MappedObject* get_or_create_mapped_object(String const& path)
|
||||
static MappedObject* get_or_create_mapped_object(DeprecatedString const& path)
|
||||
{
|
||||
if (auto it = g_mapped_object_cache.find(path); it != g_mapped_object_cache.end())
|
||||
return it->value.ptr();
|
||||
|
@ -67,7 +67,7 @@ static MappedObject* get_or_create_mapped_object(String const& path)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, String const& name)
|
||||
void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, DeprecatedString const& name)
|
||||
{
|
||||
StringView path;
|
||||
if (name.contains("Loader.so"sv))
|
||||
|
@ -82,25 +82,25 @@ void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, String const& name)
|
|||
// associated base address and size as new regions are discovered.
|
||||
|
||||
// We don't allocate a temporary String object if an entry already exists.
|
||||
// This assumes that String::hash and StringView::hash return the same result.
|
||||
// This assumes that DeprecatedString::hash and StringView::hash return the same result.
|
||||
auto string_view_compare = [&path](auto& entry) { return path == entry.key.view(); };
|
||||
if (auto existing_it = m_libraries.find(path.hash(), string_view_compare); existing_it != m_libraries.end()) {
|
||||
auto& entry = *existing_it->value;
|
||||
entry.base = min(entry.base, base);
|
||||
entry.size = max(entry.size + size, base - entry.base + size);
|
||||
} else {
|
||||
String path_string = path.to_string();
|
||||
String full_path;
|
||||
DeprecatedString path_string = path.to_string();
|
||||
DeprecatedString full_path;
|
||||
if (path_string.starts_with('/'))
|
||||
full_path = path_string;
|
||||
else if (Core::File::looks_like_shared_library(path_string))
|
||||
full_path = String::formatted("/usr/lib/{}", path);
|
||||
full_path = DeprecatedString::formatted("/usr/lib/{}", path);
|
||||
else
|
||||
full_path = path_string;
|
||||
|
||||
auto* mapped_object = get_or_create_mapped_object(full_path);
|
||||
if (!mapped_object) {
|
||||
full_path = String::formatted("/usr/local/lib/{}", path);
|
||||
full_path = DeprecatedString::formatted("/usr/local/lib/{}", path);
|
||||
mapped_object = get_or_create_mapped_object(full_path);
|
||||
if (!mapped_object)
|
||||
return;
|
||||
|
@ -112,14 +112,14 @@ void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, String const& name)
|
|||
Debug::DebugInfo const& LibraryMetadata::Library::load_debug_info(FlatPtr base_address) const
|
||||
{
|
||||
if (debug_info == nullptr)
|
||||
debug_info = make<Debug::DebugInfo>(object->elf, String::empty(), base_address);
|
||||
debug_info = make<Debug::DebugInfo>(object->elf, DeprecatedString::empty(), base_address);
|
||||
return *debug_info.ptr();
|
||||
}
|
||||
|
||||
String LibraryMetadata::Library::symbolicate(FlatPtr ptr, u32* offset) const
|
||||
DeprecatedString LibraryMetadata::Library::symbolicate(FlatPtr ptr, u32* offset) const
|
||||
{
|
||||
if (!object)
|
||||
return String::formatted("?? <{:p}>", ptr);
|
||||
return DeprecatedString::formatted("?? <{:p}>", ptr);
|
||||
|
||||
return object->elf.symbolicate(ptr - base, offset);
|
||||
}
|
||||
|
|
|
@ -21,27 +21,27 @@ struct MappedObject {
|
|||
ELF::Image elf;
|
||||
};
|
||||
|
||||
extern HashMap<String, OwnPtr<MappedObject>> g_mapped_object_cache;
|
||||
extern HashMap<DeprecatedString, OwnPtr<MappedObject>> g_mapped_object_cache;
|
||||
|
||||
class LibraryMetadata {
|
||||
public:
|
||||
struct Library {
|
||||
FlatPtr base;
|
||||
size_t size;
|
||||
String name;
|
||||
DeprecatedString name;
|
||||
MappedObject* object { nullptr };
|
||||
// This is loaded lazily because we only need it in disassembly view
|
||||
mutable OwnPtr<Debug::DebugInfo> debug_info;
|
||||
|
||||
String symbolicate(FlatPtr, u32* offset) const;
|
||||
DeprecatedString symbolicate(FlatPtr, u32* offset) const;
|
||||
Debug::DebugInfo const& load_debug_info(FlatPtr base_address) const;
|
||||
};
|
||||
|
||||
void handle_mmap(FlatPtr base, size_t size, String const& name);
|
||||
void handle_mmap(FlatPtr base, size_t size, DeprecatedString const& name);
|
||||
Library const* library_containing(FlatPtr) const;
|
||||
|
||||
private:
|
||||
mutable HashMap<String, NonnullOwnPtr<Library>> m_libraries;
|
||||
mutable HashMap<DeprecatedString, NonnullOwnPtr<Library>> m_libraries;
|
||||
};
|
||||
|
||||
struct Thread {
|
||||
|
@ -57,8 +57,8 @@ struct Thread {
|
|||
|
||||
struct Process {
|
||||
pid_t pid {};
|
||||
String executable;
|
||||
String basename;
|
||||
DeprecatedString executable;
|
||||
DeprecatedString basename;
|
||||
HashMap<int, Vector<Thread>> threads {};
|
||||
LibraryMetadata library_metadata {};
|
||||
EventSerialNumber start_valid;
|
||||
|
|
|
@ -257,7 +257,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
|
|||
if (!strings_value || !strings_value->is_array())
|
||||
return Error::from_string_literal("Malformed profile (strings is not an array)");
|
||||
|
||||
HashMap<FlatPtr, String> profile_strings;
|
||||
HashMap<FlatPtr, DeprecatedString> profile_strings;
|
||||
for (FlatPtr string_id = 0; string_id < strings_value->as_array().size(); ++string_id) {
|
||||
auto const& value = strings_value->as_array().at(string_id);
|
||||
profile_strings.set(string_id, value.to_string());
|
||||
|
@ -302,7 +302,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
|
|||
} else if (type_string == "signpost"sv) {
|
||||
auto string_id = perf_event.get("arg1"sv).to_number<FlatPtr>();
|
||||
event.data = Event::SignpostData {
|
||||
.string = profile_strings.get(string_id).value_or(String::formatted("Signpost #{}", string_id)),
|
||||
.string = profile_strings.get(string_id).value_or(DeprecatedString::formatted("Signpost #{}", string_id)),
|
||||
.arg = perf_event.get("arg2"sv).to_number<FlatPtr>(),
|
||||
};
|
||||
} else if (type_string == "mmap"sv) {
|
||||
|
@ -411,13 +411,13 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
|
|||
auto ptr = frame.to_number<u64>();
|
||||
u32 offset = 0;
|
||||
FlyString object_name;
|
||||
String symbol;
|
||||
DeprecatedString symbol;
|
||||
|
||||
if (maybe_kernel_base.has_value() && ptr >= maybe_kernel_base.value()) {
|
||||
if (g_kernel_debuginfo_object.has_value()) {
|
||||
symbol = g_kernel_debuginfo_object->elf.symbolicate(ptr - maybe_kernel_base.value(), &offset);
|
||||
} else {
|
||||
symbol = String::formatted("?? <{:p}>", ptr);
|
||||
symbol = DeprecatedString::formatted("?? <{:p}>", ptr);
|
||||
}
|
||||
} else {
|
||||
auto it = current_processes.find(event.pid);
|
||||
|
@ -429,7 +429,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
|
|||
object_name = library->name;
|
||||
symbol = library->symbolicate(ptr, &offset);
|
||||
} else {
|
||||
symbol = String::formatted("?? <{:p}>", ptr);
|
||||
symbol = DeprecatedString::formatted("?? <{:p}>", ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -610,7 +610,7 @@ ProfileNode::ProfileNode(Process const& process)
|
|||
{
|
||||
}
|
||||
|
||||
ProfileNode::ProfileNode(Process const& process, FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid)
|
||||
ProfileNode::ProfileNode(Process const& process, FlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid)
|
||||
: m_process(process)
|
||||
, m_symbol(move(symbol))
|
||||
, m_pid(pid)
|
||||
|
@ -618,7 +618,7 @@ ProfileNode::ProfileNode(Process const& process, FlyString const& object_name, S
|
|||
, m_offset(offset)
|
||||
, m_timestamp(timestamp)
|
||||
{
|
||||
String object;
|
||||
DeprecatedString object;
|
||||
if (object_name.ends_with(": .text"sv)) {
|
||||
object = object_name.view().substring_view(0, object_name.length() - 7);
|
||||
} else {
|
||||
|
|
|
@ -34,7 +34,7 @@ extern OwnPtr<Debug::DebugInfo> g_kernel_debug_info;
|
|||
|
||||
class ProfileNode : public RefCounted<ProfileNode> {
|
||||
public:
|
||||
static NonnullRefPtr<ProfileNode> create(Process const& process, FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid)
|
||||
static NonnullRefPtr<ProfileNode> create(Process const& process, FlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid)
|
||||
{
|
||||
return adopt_ref(*new ProfileNode(process, object_name, move(symbol), address, offset, timestamp, pid));
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public:
|
|||
void did_see_event(size_t event_index) { m_seen_events.set(event_index, true); }
|
||||
|
||||
FlyString const& object_name() const { return m_object_name; }
|
||||
String const& symbol() const { return m_symbol; }
|
||||
DeprecatedString const& symbol() const { return m_symbol; }
|
||||
FlatPtr address() const { return m_address; }
|
||||
u32 offset() const { return m_offset; }
|
||||
u64 timestamp() const { return m_timestamp; }
|
||||
|
@ -74,7 +74,7 @@ public:
|
|||
m_children.append(child);
|
||||
}
|
||||
|
||||
ProfileNode& find_or_create_child(FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid)
|
||||
ProfileNode& find_or_create_child(FlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid)
|
||||
{
|
||||
for (size_t i = 0; i < m_children.size(); ++i) {
|
||||
auto& child = m_children[i];
|
||||
|
@ -112,13 +112,13 @@ public:
|
|||
|
||||
private:
|
||||
explicit ProfileNode(Process const&);
|
||||
explicit ProfileNode(Process const&, FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t);
|
||||
explicit ProfileNode(Process const&, FlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t);
|
||||
|
||||
bool m_root { false };
|
||||
Process const& m_process;
|
||||
ProfileNode* m_parent { nullptr };
|
||||
FlyString m_object_name;
|
||||
String m_symbol;
|
||||
DeprecatedString m_symbol;
|
||||
pid_t m_pid { 0 };
|
||||
FlatPtr m_address { 0 };
|
||||
u32 m_offset { 0 };
|
||||
|
@ -167,7 +167,7 @@ public:
|
|||
|
||||
struct Frame {
|
||||
FlyString object_name;
|
||||
String symbol;
|
||||
DeprecatedString symbol;
|
||||
FlatPtr address { 0 };
|
||||
u32 offset { 0 };
|
||||
};
|
||||
|
@ -195,14 +195,14 @@ public:
|
|||
};
|
||||
|
||||
struct SignpostData {
|
||||
String string;
|
||||
DeprecatedString string;
|
||||
FlatPtr arg {};
|
||||
};
|
||||
|
||||
struct MmapData {
|
||||
FlatPtr ptr {};
|
||||
size_t size {};
|
||||
String name;
|
||||
DeprecatedString name;
|
||||
};
|
||||
|
||||
struct MunmapData {
|
||||
|
@ -212,11 +212,11 @@ public:
|
|||
|
||||
struct ProcessCreateData {
|
||||
pid_t parent_pid { 0 };
|
||||
String executable;
|
||||
DeprecatedString executable;
|
||||
};
|
||||
|
||||
struct ProcessExecData {
|
||||
String executable;
|
||||
DeprecatedString executable;
|
||||
};
|
||||
|
||||
struct ThreadCreateData {
|
||||
|
@ -226,7 +226,7 @@ public:
|
|||
struct ReadData {
|
||||
int fd;
|
||||
size_t size;
|
||||
String path;
|
||||
DeprecatedString path;
|
||||
size_t start_timestamp;
|
||||
bool success;
|
||||
};
|
||||
|
|
|
@ -72,7 +72,7 @@ int ProfileModel::column_count(GUI::ModelIndex const&) const
|
|||
return Column::__Count;
|
||||
}
|
||||
|
||||
String ProfileModel::column_name(int column) const
|
||||
DeprecatedString ProfileModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::SampleCount:
|
||||
|
@ -117,7 +117,7 @@ GUI::Variant ProfileModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol
|
|||
* 100.f
|
||||
/ static_cast<float>(m_profile.filtered_event_indices().size())
|
||||
* percent_digits_rounding);
|
||||
return String::formatted(
|
||||
return DeprecatedString::formatted(
|
||||
"{}.{:02}",
|
||||
percentage_full_precision / percent_digits_rounding,
|
||||
percentage_full_precision % percent_digits_rounding);
|
||||
|
@ -136,7 +136,7 @@ GUI::Variant ProfileModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol
|
|||
return node->object_name();
|
||||
if (index.column() == Column::StackFrame) {
|
||||
if (node->is_root()) {
|
||||
return String::formatted("{} ({})", node->process().basename, node->process().pid);
|
||||
return DeprecatedString::formatted("{} ({})", node->process().basename, node->process().pid);
|
||||
}
|
||||
return node->symbol();
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ GUI::Variant ProfileModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol
|
|||
auto const* library = node->process().library_metadata.library_containing(node->address());
|
||||
if (!library)
|
||||
return "";
|
||||
return String::formatted("{:p} (offset {:p})", node->address(), node->address() - library->base);
|
||||
return DeprecatedString::formatted("{:p} (offset {:p})", node->address(), node->address() - library->base);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
||||
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
||||
virtual String column_name(int) const override;
|
||||
virtual DeprecatedString column_name(int) const override;
|
||||
virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
|
||||
virtual GUI::ModelIndex index(int row, int column, GUI::ModelIndex const& parent = GUI::ModelIndex()) const override;
|
||||
virtual GUI::ModelIndex parent_index(GUI::ModelIndex const&) const override;
|
||||
|
|
|
@ -28,7 +28,7 @@ int SamplesModel::column_count(GUI::ModelIndex const&) const
|
|||
return Column::__Count;
|
||||
}
|
||||
|
||||
String SamplesModel::column_name(int column) const
|
||||
DeprecatedString SamplesModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::SampleIndex:
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
||||
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
||||
virtual String column_name(int) const override;
|
||||
virtual DeprecatedString column_name(int) const override;
|
||||
virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
|
||||
virtual bool is_column_sortable(int) const override { return false; }
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ int SignpostsModel::column_count(GUI::ModelIndex const&) const
|
|||
return Column::__Count;
|
||||
}
|
||||
|
||||
String SignpostsModel::column_name(int column) const
|
||||
DeprecatedString SignpostsModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::SignpostIndex:
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
||||
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
||||
virtual String column_name(int) const override;
|
||||
virtual DeprecatedString column_name(int) const override;
|
||||
virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
|
||||
virtual bool is_column_sortable(int) const override { return false; }
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Profiler {
|
|||
class SourceFile final {
|
||||
public:
|
||||
struct Line {
|
||||
String content;
|
||||
DeprecatedString content;
|
||||
size_t num_samples { 0 };
|
||||
};
|
||||
|
||||
|
@ -26,7 +26,7 @@ public:
|
|||
|
||||
SourceFile(StringView filename)
|
||||
{
|
||||
String source_file_name = filename.replace("../../"sv, source_root_path, ReplaceMode::FirstOnly);
|
||||
DeprecatedString source_file_name = filename.replace("../../"sv, source_root_path, ReplaceMode::FirstOnly);
|
||||
|
||||
auto try_read_lines = [&]() -> ErrorOr<void> {
|
||||
auto unbuffered_file = TRY(Core::Stream::File::open(source_file_name, Core::Stream::OpenMode::Read));
|
||||
|
@ -71,7 +71,7 @@ SourceModel::SourceModel(Profile& profile, ProfileNode& node)
|
|||
return;
|
||||
base_address = maybe_kernel_base.release_value();
|
||||
if (g_kernel_debug_info == nullptr)
|
||||
g_kernel_debug_info = make<Debug::DebugInfo>(g_kernel_debuginfo_object->elf, String::empty(), base_address);
|
||||
g_kernel_debug_info = make<Debug::DebugInfo>(g_kernel_debuginfo_object->elf, DeprecatedString::empty(), base_address);
|
||||
debug_info = g_kernel_debug_info.ptr();
|
||||
} else {
|
||||
auto const& process = node.process();
|
||||
|
@ -87,7 +87,7 @@ SourceModel::SourceModel(Profile& profile, ProfileNode& node)
|
|||
VERIFY(debug_info != nullptr);
|
||||
|
||||
// Try to read all source files contributing to the selected function and aggregate the samples by line.
|
||||
HashMap<String, SourceFile> source_files;
|
||||
HashMap<DeprecatedString, SourceFile> source_files;
|
||||
for (auto const& pair : node.events_per_address()) {
|
||||
auto position = debug_info->get_source_position(pair.key - base_address);
|
||||
if (position.has_value()) {
|
||||
|
@ -123,7 +123,7 @@ int SourceModel::row_count(GUI::ModelIndex const&) const
|
|||
return m_source_lines.size();
|
||||
}
|
||||
|
||||
String SourceModel::column_name(int column) const
|
||||
DeprecatedString SourceModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::SampleCount:
|
||||
|
|
|
@ -16,9 +16,9 @@ class ProfileNode;
|
|||
struct SourceLineData {
|
||||
u32 event_count { 0 };
|
||||
float percent { 0 };
|
||||
String location;
|
||||
DeprecatedString location;
|
||||
u32 line_number { 0 };
|
||||
String source_code;
|
||||
DeprecatedString source_code;
|
||||
};
|
||||
|
||||
class SourceModel final : public GUI::Model {
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
||||
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; }
|
||||
virtual String column_name(int) const override;
|
||||
virtual DeprecatedString column_name(int) const override;
|
||||
virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
|
||||
virtual bool is_column_sortable(int) const override { return false; }
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ TimelineHeader::TimelineHeader(Profile& profile, Process const& process)
|
|||
update_selection();
|
||||
|
||||
m_icon = GUI::FileIconProvider::icon_for_executable(m_process.executable).bitmap_for_size(32);
|
||||
m_text = String::formatted("{} ({})", LexicalPath::basename(m_process.executable), m_process.pid);
|
||||
m_text = DeprecatedString::formatted("{} ({})", LexicalPath::basename(m_process.executable), m_process.pid);
|
||||
}
|
||||
|
||||
void TimelineHeader::paint_event(GUI::PaintEvent& event)
|
||||
|
|
|
@ -33,7 +33,7 @@ private:
|
|||
Profile& m_profile;
|
||||
Process const& m_process;
|
||||
RefPtr<Gfx::Bitmap> m_icon;
|
||||
String m_text;
|
||||
DeprecatedString m_text;
|
||||
bool m_selected;
|
||||
};
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ void TimelineTrack::mousemove_event(GUI::MouseEvent& event)
|
|||
Gfx::IntRect hoverable_rect { x - hoverable_padding, frame_thickness(), hoverable_padding * 2, height() - frame_thickness() * 2 };
|
||||
if (hoverable_rect.contains_horizontally(event.x())) {
|
||||
auto const& data = signpost.data.template get<Profile::Event::SignpostData>();
|
||||
GUI::Application::the()->show_tooltip_immediately(String::formatted("{}, {}", data.string, data.arg), this);
|
||||
GUI::Application::the()->show_tooltip_immediately(DeprecatedString::formatted("{}, {}", data.string, data.arg), this);
|
||||
hovering_a_signpost = true;
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
|
|
|
@ -60,18 +60,18 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-profiler"sv));
|
||||
|
||||
String perfcore_file;
|
||||
DeprecatedString perfcore_file;
|
||||
if (!perfcore_file_arg) {
|
||||
if (!generate_profile(pid))
|
||||
return 0;
|
||||
perfcore_file = String::formatted("/proc/{}/perf_events", pid);
|
||||
perfcore_file = DeprecatedString::formatted("/proc/{}/perf_events", pid);
|
||||
} else {
|
||||
perfcore_file = perfcore_file_arg;
|
||||
}
|
||||
|
||||
auto profile_or_error = Profile::load_from_perfcore_file(perfcore_file);
|
||||
if (profile_or_error.is_error()) {
|
||||
GUI::MessageBox::show(nullptr, String::formatted("{}", profile_or_error.error()), "Profiler"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(nullptr, DeprecatedString::formatted("{}", profile_or_error.error()), "Profiler"sv, GUI::MessageBox::Type::Error);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -223,11 +223,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
|
||||
// FIXME: Make this constexpr once String is able to.
|
||||
auto const sample_count_percent_format_string = String::formatted("{{:.{}f}}%", number_of_percent_digits);
|
||||
auto const sample_count_percent_format_string = DeprecatedString::formatted("{{:.{}f}}%", number_of_percent_digits);
|
||||
auto const format_sample_count = [&profile, sample_count_percent_format_string](auto const sample_count) {
|
||||
if (profile->show_percentages())
|
||||
return String::formatted(sample_count_percent_format_string, sample_count.as_float_or(0.0));
|
||||
return String::formatted("{} Samples", sample_count.to_i32());
|
||||
return DeprecatedString::formatted(sample_count_percent_format_string, sample_count.as_float_or(0.0));
|
||||
return DeprecatedString::formatted("{} Samples", sample_count.to_i32());
|
||||
};
|
||||
|
||||
auto statusbar = TRY(main_widget->try_add<GUI::Statusbar>());
|
||||
|
@ -310,10 +310,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return app->exec();
|
||||
}
|
||||
|
||||
static bool prompt_to_stop_profiling(pid_t pid, String const& process_name)
|
||||
static bool prompt_to_stop_profiling(pid_t pid, DeprecatedString const& process_name)
|
||||
{
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title(String::formatted("Profiling {}({})", process_name, pid));
|
||||
window->set_title(DeprecatedString::formatted("Profiling {}({})", process_name, pid));
|
||||
window->resize(240, 100);
|
||||
window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
window->center_on_screen();
|
||||
|
@ -327,7 +327,7 @@ static bool prompt_to_stop_profiling(pid_t pid, String const& process_name)
|
|||
Core::ElapsedTimer clock;
|
||||
clock.start();
|
||||
auto update_timer = Core::Timer::construct(100, [&] {
|
||||
timer_label.set_text(String::formatted("{:.1} seconds", clock.elapsed() / 1000.0f));
|
||||
timer_label.set_text(DeprecatedString::formatted("{:.1} seconds", clock.elapsed() / 1000.0f));
|
||||
});
|
||||
|
||||
auto& stop_button = widget.add<GUI::Button>("Stop");
|
||||
|
@ -349,7 +349,7 @@ bool generate_profile(pid_t& pid)
|
|||
pid = process_chooser->pid();
|
||||
}
|
||||
|
||||
String process_name;
|
||||
DeprecatedString process_name;
|
||||
|
||||
auto all_processes = Core::ProcessStatisticsReader::get_all();
|
||||
if (all_processes.has_value()) {
|
||||
|
@ -367,7 +367,7 @@ bool generate_profile(pid_t& pid)
|
|||
|
||||
if (profiling_enable(pid, event_mask) < 0) {
|
||||
int saved_errno = errno;
|
||||
GUI::MessageBox::show(nullptr, String::formatted("Unable to profile process {}({}): {}", process_name, pid, strerror(saved_errno)), "Profiler"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(nullptr, DeprecatedString::formatted("Unable to profile process {}({}): {}", process_name, pid, strerror(saved_errno)), "Profiler"sv, GUI::MessageBox::Type::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue