mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:37:34 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -51,7 +51,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, DeprecatedString::empty(), base_address);
|
||||
g_kernel_debug_info = make<Debug::DebugInfo>(g_kernel_debuginfo_object->elf, ByteString::empty(), base_address);
|
||||
debug_info = g_kernel_debug_info.ptr();
|
||||
} else {
|
||||
auto const& process = node.process();
|
||||
|
@ -114,7 +114,7 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node)
|
|||
break;
|
||||
FlatPtr address_in_profiled_program = node.address() + offset_into_symbol;
|
||||
|
||||
auto disassembly = insn.value().to_deprecated_string(address_in_profiled_program, &symbol_provider);
|
||||
auto disassembly = insn.value().to_byte_string(address_in_profiled_program, &symbol_provider);
|
||||
|
||||
StringView instruction_bytes = view.substring_view(offset_into_symbol, insn.value().length());
|
||||
u32 samples_at_this_instruction = m_node.events_per_address().get(address_in_profiled_program).value_or(0);
|
||||
|
@ -200,14 +200,14 @@ GUI::Variant DisassemblyModel::data(GUI::ModelIndex const& index, GUI::ModelRole
|
|||
}
|
||||
|
||||
if (index.column() == Column::Address)
|
||||
return DeprecatedString::formatted("{:p}", insn.address);
|
||||
return ByteString::formatted("{:p}", insn.address);
|
||||
|
||||
if (index.column() == Column::InstructionBytes) {
|
||||
StringBuilder builder;
|
||||
for (auto ch : insn.bytes) {
|
||||
builder.appendff("{:02x} ", (u8)ch);
|
||||
}
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
}
|
||||
|
||||
if (index.column() == Column::Disassembly)
|
||||
|
@ -229,7 +229,7 @@ GUI::Variant DisassemblyModel::data(GUI::ModelIndex const& index, GUI::ModelRole
|
|||
auto const& entry = insn.source_position_with_inlines.source_position.value();
|
||||
builder.appendff("{}:{}", entry.file_path, entry.line_number);
|
||||
}
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
|
@ -18,7 +18,7 @@ class ProfileNode;
|
|||
|
||||
struct InstructionData {
|
||||
X86::Instruction insn;
|
||||
DeprecatedString disassembly;
|
||||
ByteString disassembly;
|
||||
StringView bytes;
|
||||
FlatPtr address { 0 };
|
||||
u32 event_count { 0 };
|
||||
|
|
|
@ -32,7 +32,7 @@ Duration FileEventNode::total_duration() const
|
|||
return m_open.duration + m_close.duration + m_readv.duration + m_read.duration + m_pread.duration;
|
||||
}
|
||||
|
||||
FileEventNode& FileEventNode::find_or_create_node(DeprecatedString const& searched_path)
|
||||
FileEventNode& FileEventNode::find_or_create_node(ByteString const& searched_path)
|
||||
{
|
||||
// TODO: Optimize this function.
|
||||
if (searched_path == ""sv || searched_path == "/"sv) {
|
||||
|
@ -45,7 +45,7 @@ FileEventNode& FileEventNode::find_or_create_node(DeprecatedString const& search
|
|||
|
||||
StringBuilder sb;
|
||||
sb.join('/', parts);
|
||||
auto new_s = sb.to_deprecated_string();
|
||||
auto new_s = sb.to_byte_string();
|
||||
|
||||
for (auto& child : m_children) {
|
||||
if (child->m_path == current) {
|
||||
|
@ -70,7 +70,7 @@ FileEventNode& FileEventNode::find_or_create_node(DeprecatedString const& search
|
|||
}
|
||||
}
|
||||
|
||||
FileEventNode& FileEventNode::create_recursively(DeprecatedString new_path)
|
||||
FileEventNode& FileEventNode::create_recursively(ByteString new_path)
|
||||
{
|
||||
auto const lex_path = LexicalPath(new_path);
|
||||
auto parts = lex_path.parts();
|
||||
|
@ -86,7 +86,7 @@ FileEventNode& FileEventNode::create_recursively(DeprecatedString new_path)
|
|||
StringBuilder sb;
|
||||
sb.join('/', parts);
|
||||
|
||||
return new_node->create_recursively(sb.to_deprecated_string());
|
||||
return new_node->create_recursively(sb.to_byte_string());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/Time.h>
|
||||
|
@ -18,23 +18,23 @@ class Profile;
|
|||
|
||||
class FileEventNode : public RefCounted<FileEventNode> {
|
||||
public:
|
||||
static NonnullRefPtr<FileEventNode> create(DeprecatedString const& path, FileEventNode* parent = nullptr)
|
||||
static NonnullRefPtr<FileEventNode> create(ByteString const& path, FileEventNode* parent = nullptr)
|
||||
{
|
||||
return adopt_ref(*new FileEventNode(path, parent));
|
||||
}
|
||||
|
||||
FileEventNode& find_or_create_node(DeprecatedString const&);
|
||||
FileEventNode& find_or_create_node(ByteString 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(DeprecatedString);
|
||||
FileEventNode& create_recursively(ByteString);
|
||||
|
||||
void for_each_parent_node(Function<void(FileEventNode&)> callback);
|
||||
|
||||
DeprecatedString const& path() const { return m_path; }
|
||||
ByteString const& path() const { return m_path; }
|
||||
|
||||
u64 total_count() const;
|
||||
Duration total_duration() const;
|
||||
|
@ -51,11 +51,11 @@ public:
|
|||
FileEventType& pread() { return m_pread; }
|
||||
|
||||
private:
|
||||
FileEventNode(DeprecatedString const& path, FileEventNode* parent = nullptr)
|
||||
FileEventNode(ByteString const& path, FileEventNode* parent = nullptr)
|
||||
: m_path(path)
|
||||
, m_parent(parent) {};
|
||||
|
||||
DeprecatedString m_path;
|
||||
ByteString m_path;
|
||||
|
||||
FileEventType m_open;
|
||||
FileEventType m_close;
|
||||
|
|
|
@ -180,7 +180,7 @@ String FlameGraphView::bar_label(StackBar const& bar) const
|
|||
auto label_index = bar.index.sibling_at_column(m_text_column);
|
||||
String label = "All"_string;
|
||||
if (label_index.is_valid()) {
|
||||
label = MUST(String::from_deprecated_string(m_model.data(label_index).to_deprecated_string()));
|
||||
label = MUST(String::from_byte_string(m_model.data(label_index).to_byte_string()));
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
|
|
@ -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 DeprecatedString::formatted("{:p}", frame.address);
|
||||
return ByteString::formatted("{:p}", frame.address);
|
||||
|
||||
if (index.column() == Column::Symbol) {
|
||||
return frame.symbol;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/IntegralMath.h>
|
||||
#include <AK/Math.h>
|
||||
|
||||
|
@ -16,10 +16,10 @@ namespace Profiler {
|
|||
static constexpr int const number_of_percent_digits = 2;
|
||||
static constexpr int const percent_digits_rounding = AK::pow(10, number_of_percent_digits);
|
||||
|
||||
DeprecatedString format_percentage(auto value, auto total)
|
||||
ByteString format_percentage(auto value, auto total)
|
||||
{
|
||||
auto percentage_full_precision = round_to<u64>(value * 100.f / total * percent_digits_rounding);
|
||||
return DeprecatedString::formatted(
|
||||
return ByteString::formatted(
|
||||
"{}.{:02}",
|
||||
percentage_full_precision / percent_digits_rounding,
|
||||
percentage_full_precision % percent_digits_rounding);
|
||||
|
|
|
@ -41,9 +41,9 @@ void Process::handle_thread_exit(pid_t tid, EventSerialNumber serial)
|
|||
thread->end_valid = serial;
|
||||
}
|
||||
|
||||
HashMap<DeprecatedString, OwnPtr<MappedObject>> g_mapped_object_cache;
|
||||
HashMap<ByteString, OwnPtr<MappedObject>> g_mapped_object_cache;
|
||||
|
||||
static MappedObject* get_or_create_mapped_object(DeprecatedString const& path)
|
||||
static MappedObject* get_or_create_mapped_object(ByteString 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(DeprecatedString const& path)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, DeprecatedString const& name)
|
||||
void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, ByteString const& name)
|
||||
{
|
||||
StringView path;
|
||||
if (name.contains("Loader.so"sv))
|
||||
|
@ -82,25 +82,25 @@ void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, DeprecatedString co
|
|||
// 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 DeprecatedString::hash and StringView::hash return the same result.
|
||||
// This assumes that ByteString::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 {
|
||||
DeprecatedString path_string = path.to_deprecated_string();
|
||||
DeprecatedString full_path;
|
||||
ByteString path_string = path.to_byte_string();
|
||||
ByteString full_path;
|
||||
if (path_string.starts_with('/'))
|
||||
full_path = path_string;
|
||||
else if (FileSystem::looks_like_shared_library(path_string))
|
||||
full_path = DeprecatedString::formatted("/usr/lib/{}", path);
|
||||
full_path = ByteString::formatted("/usr/lib/{}", path);
|
||||
else
|
||||
full_path = path_string;
|
||||
|
||||
auto* mapped_object = get_or_create_mapped_object(full_path);
|
||||
if (!mapped_object) {
|
||||
full_path = DeprecatedString::formatted("/usr/local/lib/{}", path);
|
||||
full_path = ByteString::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, DeprecatedString co
|
|||
Debug::DebugInfo const& LibraryMetadata::Library::load_debug_info(FlatPtr base_address) const
|
||||
{
|
||||
if (debug_info == nullptr)
|
||||
debug_info = make<Debug::DebugInfo>(object->elf, DeprecatedString::empty(), base_address);
|
||||
debug_info = make<Debug::DebugInfo>(object->elf, ByteString::empty(), base_address);
|
||||
return *debug_info.ptr();
|
||||
}
|
||||
|
||||
DeprecatedString LibraryMetadata::Library::symbolicate(FlatPtr ptr, u32* offset) const
|
||||
ByteString LibraryMetadata::Library::symbolicate(FlatPtr ptr, u32* offset) const
|
||||
{
|
||||
if (!object)
|
||||
return DeprecatedString::formatted("?? <{:p}>", ptr);
|
||||
return ByteString::formatted("?? <{:p}>", ptr);
|
||||
|
||||
return object->elf.symbolicate(ptr - base, offset);
|
||||
}
|
||||
|
|
|
@ -21,27 +21,27 @@ struct MappedObject {
|
|||
ELF::Image elf;
|
||||
};
|
||||
|
||||
extern HashMap<DeprecatedString, OwnPtr<MappedObject>> g_mapped_object_cache;
|
||||
extern HashMap<ByteString, OwnPtr<MappedObject>> g_mapped_object_cache;
|
||||
|
||||
class LibraryMetadata {
|
||||
public:
|
||||
struct Library {
|
||||
FlatPtr base;
|
||||
size_t size;
|
||||
DeprecatedString name;
|
||||
ByteString name;
|
||||
MappedObject* object { nullptr };
|
||||
// This is loaded lazily because we only need it in disassembly view
|
||||
mutable OwnPtr<Debug::DebugInfo> debug_info;
|
||||
|
||||
DeprecatedString symbolicate(FlatPtr, u32* offset) const;
|
||||
ByteString symbolicate(FlatPtr, u32* offset) const;
|
||||
Debug::DebugInfo const& load_debug_info(FlatPtr base_address) const;
|
||||
};
|
||||
|
||||
void handle_mmap(FlatPtr base, size_t size, DeprecatedString const& name);
|
||||
void handle_mmap(FlatPtr base, size_t size, ByteString const& name);
|
||||
Library const* library_containing(FlatPtr) const;
|
||||
|
||||
private:
|
||||
mutable HashMap<DeprecatedString, NonnullOwnPtr<Library>> m_libraries;
|
||||
mutable HashMap<ByteString, NonnullOwnPtr<Library>> m_libraries;
|
||||
};
|
||||
|
||||
struct Thread {
|
||||
|
@ -57,8 +57,8 @@ struct Thread {
|
|||
|
||||
struct Process {
|
||||
pid_t pid {};
|
||||
DeprecatedString executable;
|
||||
DeprecatedString basename;
|
||||
ByteString executable;
|
||||
ByteString basename;
|
||||
HashMap<int, Vector<Thread>> threads {};
|
||||
LibraryMetadata library_metadata {};
|
||||
EventSerialNumber start_valid;
|
||||
|
|
|
@ -289,10 +289,10 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
|
|||
return Error::from_string_literal("Malformed profile (strings is not an array)");
|
||||
auto const& strings = strings_value.value();
|
||||
|
||||
HashMap<FlatPtr, DeprecatedString> profile_strings;
|
||||
HashMap<FlatPtr, ByteString> profile_strings;
|
||||
for (FlatPtr string_id = 0; string_id < strings.size(); ++string_id) {
|
||||
auto const& value = strings.at(string_id);
|
||||
profile_strings.set(string_id, value.to_deprecated_string());
|
||||
profile_strings.set(string_id, value.to_byte_string());
|
||||
}
|
||||
|
||||
auto events_value = object.get_array("events"sv);
|
||||
|
@ -317,7 +317,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
|
|||
event.pid = perf_event.get_i32("pid"sv).value_or(0);
|
||||
event.tid = perf_event.get_i32("tid"sv).value_or(0);
|
||||
|
||||
auto type_string = perf_event.get_deprecated_string("type"sv).value_or({});
|
||||
auto type_string = perf_event.get_byte_string("type"sv).value_or({});
|
||||
|
||||
if (type_string == "sample"sv) {
|
||||
event.data = Event::SampleData {};
|
||||
|
@ -333,13 +333,13 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
|
|||
} else if (type_string == "signpost"sv) {
|
||||
auto string_id = perf_event.get_addr("arg1"sv).value_or(0);
|
||||
event.data = Event::SignpostData {
|
||||
.string = profile_strings.get(string_id).value_or(DeprecatedString::formatted("Signpost #{}", string_id)),
|
||||
.string = profile_strings.get(string_id).value_or(ByteString::formatted("Signpost #{}", string_id)),
|
||||
.arg = perf_event.get_addr("arg2"sv).value_or(0),
|
||||
};
|
||||
} else if (type_string == "mmap"sv) {
|
||||
auto ptr = perf_event.get_addr("ptr"sv).value_or(0);
|
||||
auto size = perf_event.get_integer<size_t>("size"sv).value_or(0);
|
||||
auto name = perf_event.get_deprecated_string("name"sv).value_or({});
|
||||
auto name = perf_event.get_byte_string("name"sv).value_or({});
|
||||
|
||||
event.data = Event::MmapData {
|
||||
.ptr = ptr,
|
||||
|
@ -359,7 +359,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
|
|||
continue;
|
||||
} else if (type_string == "process_create"sv) {
|
||||
auto parent_pid = perf_event.get_integer<pid_t>("parent_pid"sv).value_or(0);
|
||||
auto executable = perf_event.get_deprecated_string("executable"sv).value_or({});
|
||||
auto executable = perf_event.get_byte_string("executable"sv).value_or({});
|
||||
event.data = Event::ProcessCreateData {
|
||||
.parent_pid = parent_pid,
|
||||
.executable = executable,
|
||||
|
@ -377,7 +377,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
|
|||
all_processes.append(move(sampled_process));
|
||||
continue;
|
||||
} else if (type_string == "process_exec"sv) {
|
||||
auto executable = perf_event.get_deprecated_string("executable"sv).value_or({});
|
||||
auto executable = perf_event.get_byte_string("executable"sv).value_or({});
|
||||
event.data = Event::ProcessExecData {
|
||||
.executable = executable,
|
||||
};
|
||||
|
@ -482,13 +482,13 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
|
|||
auto ptr = frame.to_number<u64>();
|
||||
u32 offset = 0;
|
||||
DeprecatedFlyString object_name;
|
||||
DeprecatedString symbol;
|
||||
ByteString 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 = DeprecatedString::formatted("?? <{:p}>", ptr);
|
||||
symbol = ByteString::formatted("?? <{:p}>", ptr);
|
||||
}
|
||||
} else {
|
||||
auto it = current_processes.find(event.pid);
|
||||
|
@ -500,7 +500,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
|
|||
object_name = library->name;
|
||||
symbol = library->symbolicate(ptr, &offset);
|
||||
} else {
|
||||
symbol = DeprecatedString::formatted("?? <{:p}>", ptr);
|
||||
symbol = ByteString::formatted("?? <{:p}>", ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -681,7 +681,7 @@ ProfileNode::ProfileNode(Process const& process)
|
|||
{
|
||||
}
|
||||
|
||||
ProfileNode::ProfileNode(Process const& process, DeprecatedFlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid)
|
||||
ProfileNode::ProfileNode(Process const& process, DeprecatedFlyString const& object_name, ByteString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid)
|
||||
: m_process(process)
|
||||
, m_symbol(move(symbol))
|
||||
, m_pid(pid)
|
||||
|
@ -689,7 +689,7 @@ ProfileNode::ProfileNode(Process const& process, DeprecatedFlyString const& obje
|
|||
, m_offset(offset)
|
||||
, m_timestamp(timestamp)
|
||||
{
|
||||
DeprecatedString object;
|
||||
ByteString object;
|
||||
if (object_name.ends_with(": .text"sv)) {
|
||||
object = object_name.view().substring_view(0, object_name.length() - 7);
|
||||
} else {
|
||||
|
|
|
@ -35,7 +35,7 @@ extern OwnPtr<Debug::DebugInfo> g_kernel_debug_info;
|
|||
|
||||
class ProfileNode : public RefCounted<ProfileNode> {
|
||||
public:
|
||||
static NonnullRefPtr<ProfileNode> create(Process const& process, DeprecatedFlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid)
|
||||
static NonnullRefPtr<ProfileNode> create(Process const& process, DeprecatedFlyString const& object_name, ByteString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid)
|
||||
{
|
||||
return adopt_ref(*new ProfileNode(process, object_name, move(symbol), address, offset, timestamp, pid));
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
void did_see_event(size_t event_index) { m_seen_events.set(event_index, true); }
|
||||
|
||||
DeprecatedFlyString const& object_name() const { return m_object_name; }
|
||||
DeprecatedString const& symbol() const { return m_symbol; }
|
||||
ByteString const& symbol() const { return m_symbol; }
|
||||
FlatPtr address() const { return m_address; }
|
||||
u32 offset() const { return m_offset; }
|
||||
u64 timestamp() const { return m_timestamp; }
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
m_children.append(child);
|
||||
}
|
||||
|
||||
ProfileNode& find_or_create_child(DeprecatedFlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid)
|
||||
ProfileNode& find_or_create_child(DeprecatedFlyString const& object_name, ByteString 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];
|
||||
|
@ -113,13 +113,13 @@ public:
|
|||
|
||||
private:
|
||||
explicit ProfileNode(Process const&);
|
||||
explicit ProfileNode(Process const&, DeprecatedFlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t);
|
||||
explicit ProfileNode(Process const&, DeprecatedFlyString const& object_name, ByteString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t);
|
||||
|
||||
bool m_root { false };
|
||||
Process const& m_process;
|
||||
ProfileNode* m_parent { nullptr };
|
||||
DeprecatedFlyString m_object_name;
|
||||
DeprecatedString m_symbol;
|
||||
ByteString m_symbol;
|
||||
pid_t m_pid { 0 };
|
||||
FlatPtr m_address { 0 };
|
||||
u32 m_offset { 0 };
|
||||
|
@ -168,7 +168,7 @@ public:
|
|||
|
||||
struct Frame {
|
||||
DeprecatedFlyString object_name;
|
||||
DeprecatedString symbol;
|
||||
ByteString symbol;
|
||||
FlatPtr address { 0 };
|
||||
u32 offset { 0 };
|
||||
};
|
||||
|
@ -196,14 +196,14 @@ public:
|
|||
};
|
||||
|
||||
struct SignpostData {
|
||||
DeprecatedString string;
|
||||
ByteString string;
|
||||
FlatPtr arg {};
|
||||
};
|
||||
|
||||
struct MmapData {
|
||||
FlatPtr ptr {};
|
||||
size_t size {};
|
||||
DeprecatedString name;
|
||||
ByteString name;
|
||||
};
|
||||
|
||||
struct MunmapData {
|
||||
|
@ -213,11 +213,11 @@ public:
|
|||
|
||||
struct ProcessCreateData {
|
||||
pid_t parent_pid { 0 };
|
||||
DeprecatedString executable;
|
||||
ByteString executable;
|
||||
};
|
||||
|
||||
struct ProcessExecData {
|
||||
DeprecatedString executable;
|
||||
ByteString executable;
|
||||
};
|
||||
|
||||
struct ThreadCreateData {
|
||||
|
@ -227,31 +227,31 @@ public:
|
|||
// Based on Syscall::SC_open_params
|
||||
struct OpenEventData {
|
||||
int dirfd;
|
||||
DeprecatedString path;
|
||||
ByteString path;
|
||||
int options;
|
||||
u64 mode;
|
||||
};
|
||||
|
||||
struct CloseEventData {
|
||||
int fd;
|
||||
DeprecatedString path;
|
||||
ByteString path;
|
||||
};
|
||||
|
||||
struct ReadvEventData {
|
||||
int fd;
|
||||
DeprecatedString path;
|
||||
ByteString path;
|
||||
// struct iovec* iov; // TODO: Implement
|
||||
// int iov_count; // TODO: Implement
|
||||
};
|
||||
|
||||
struct ReadEventData {
|
||||
int fd;
|
||||
DeprecatedString path;
|
||||
ByteString path;
|
||||
};
|
||||
|
||||
struct PreadEventData {
|
||||
int fd;
|
||||
DeprecatedString path;
|
||||
ByteString path;
|
||||
FlatPtr buffer_ptr;
|
||||
size_t size;
|
||||
off_t offset;
|
||||
|
|
|
@ -126,7 +126,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 DeprecatedString::formatted("{} ({})", node->process().basename, node->process().pid);
|
||||
return ByteString::formatted("{} ({})", node->process().basename, node->process().pid);
|
||||
}
|
||||
return node->symbol();
|
||||
}
|
||||
|
@ -136,7 +136,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 DeprecatedString::formatted("{:p} (offset {:p})", node->address(), node->address() - library->base);
|
||||
return ByteString::formatted("{:p} (offset {:p})", node->address(), node->address() - library->base);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Profiler {
|
|||
class SourceFile final {
|
||||
public:
|
||||
struct Line {
|
||||
DeprecatedString content;
|
||||
ByteString content;
|
||||
size_t num_samples { 0 };
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,7 @@ public:
|
|||
|
||||
SourceFile(StringView filename)
|
||||
{
|
||||
DeprecatedString source_file_name = filename.replace("../../"sv, source_root_path, ReplaceMode::FirstOnly);
|
||||
ByteString source_file_name = filename.replace("../../"sv, source_root_path, ReplaceMode::FirstOnly);
|
||||
|
||||
auto try_read_lines = [&]() -> ErrorOr<void> {
|
||||
auto unbuffered_file = TRY(Core::File::open(source_file_name, Core::File::OpenMode::Read));
|
||||
|
@ -70,7 +70,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, DeprecatedString::empty(), base_address);
|
||||
g_kernel_debug_info = make<Debug::DebugInfo>(g_kernel_debuginfo_object->elf, ByteString::empty(), base_address);
|
||||
debug_info = g_kernel_debug_info.ptr();
|
||||
} else {
|
||||
auto const& process = node.process();
|
||||
|
@ -86,7 +86,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<DeprecatedString, SourceFile> source_files;
|
||||
HashMap<ByteString, 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()) {
|
||||
|
|
|
@ -16,9 +16,9 @@ class ProfileNode;
|
|||
struct SourceLineData {
|
||||
u32 event_count { 0 };
|
||||
float percent { 0 };
|
||||
DeprecatedString location;
|
||||
ByteString location;
|
||||
u32 line_number { 0 };
|
||||
DeprecatedString source_code;
|
||||
ByteString source_code;
|
||||
};
|
||||
|
||||
class SourceModel final : public GUI::Model {
|
||||
|
|
|
@ -24,7 +24,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 = DeprecatedString::formatted("{} ({})", LexicalPath::basename(m_process.executable), m_process.pid);
|
||||
m_text = ByteString::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 const> m_icon;
|
||||
DeprecatedString m_text;
|
||||
ByteString m_text;
|
||||
bool m_selected;
|
||||
};
|
||||
|
||||
|
|
|
@ -62,18 +62,18 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto app = TRY(GUI::Application::create(arguments));
|
||||
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-profiler"sv));
|
||||
|
||||
DeprecatedString perfcore_file;
|
||||
ByteString perfcore_file;
|
||||
if (perfcore_file_arg.is_empty()) {
|
||||
if (!generate_profile(pid))
|
||||
return 0;
|
||||
perfcore_file = DeprecatedString::formatted("/proc/{}/perf_events", pid);
|
||||
perfcore_file = ByteString::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, DeprecatedString::formatted("{}", profile_or_error.error()), "Profiler"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(nullptr, ByteString::formatted("{}", profile_or_error.error()), "Profiler"sv, GUI::MessageBox::Type::Error);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -224,8 +224,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
// FIXME: Make this constexpr once String is able to.
|
||||
auto const format_sample_count = [&profile](auto const sample_count) {
|
||||
if (profile->show_percentages())
|
||||
return DeprecatedString::formatted("{}%", sample_count.as_string());
|
||||
return DeprecatedString::formatted("{} Samples", sample_count.to_i32());
|
||||
return ByteString::formatted("{}%", sample_count.as_string());
|
||||
return ByteString::formatted("{} Samples", sample_count.to_i32());
|
||||
};
|
||||
|
||||
auto& statusbar = main_widget->add<GUI::Statusbar>();
|
||||
|
@ -235,7 +235,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto flamegraph_hovered_index = flamegraph_view.hovered_index();
|
||||
if (flamegraph_hovered_index.is_valid()) {
|
||||
auto stack = profile->model().data(flamegraph_hovered_index.sibling_at_column(ProfileModel::Column::StackFrame)).to_deprecated_string();
|
||||
auto stack = profile->model().data(flamegraph_hovered_index.sibling_at_column(ProfileModel::Column::StackFrame)).to_byte_string();
|
||||
auto sample_count = profile->model().data(flamegraph_hovered_index.sibling_at_column(ProfileModel::Column::SampleCount));
|
||||
auto self_count = profile->model().data(flamegraph_hovered_index.sibling_at_column(ProfileModel::Column::SelfCount));
|
||||
builder.appendff("{}, ", stack);
|
||||
|
@ -312,10 +312,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return app->exec();
|
||||
}
|
||||
|
||||
static bool prompt_to_stop_profiling(pid_t pid, DeprecatedString const& process_name)
|
||||
static bool prompt_to_stop_profiling(pid_t pid, ByteString const& process_name)
|
||||
{
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title(DeprecatedString::formatted("Profiling {}({})", process_name, pid));
|
||||
window->set_title(ByteString::formatted("Profiling {}({})", process_name, pid));
|
||||
window->resize(240, 100);
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
window->center_on_screen();
|
||||
|
@ -351,7 +351,7 @@ bool generate_profile(pid_t& pid)
|
|||
pid = process_chooser->pid();
|
||||
}
|
||||
|
||||
DeprecatedString process_name;
|
||||
ByteString process_name;
|
||||
|
||||
auto all_processes = Core::ProcessStatisticsReader::get_all();
|
||||
if (!all_processes.is_error()) {
|
||||
|
@ -369,7 +369,7 @@ bool generate_profile(pid_t& pid)
|
|||
|
||||
if (profiling_enable(pid, event_mask) < 0) {
|
||||
int saved_errno = errno;
|
||||
GUI::MessageBox::show(nullptr, DeprecatedString::formatted("Unable to profile process {}({}): {}", process_name, pid, strerror(saved_errno)), "Profiler"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(nullptr, ByteString::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