Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevTools/Profiler: Replace DeprecatedFlyString with FlyString #25492

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Userland/DevTools/Profiler/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
auto const& frame = stack_array.at(i);
auto ptr = frame.as_integer<u64>();
u32 offset = 0;
DeprecatedFlyString object_name;
FlyString object_name;
ByteString symbol;

if (maybe_kernel_base.has_value() && ptr >= maybe_kernel_base.value()) {
Expand All @@ -497,7 +497,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
if (it != current_processes.end())
library_metadata = &it->value->library_metadata;
if (auto const* library = library_metadata ? library_metadata->library_containing(ptr) : nullptr) {
object_name = library->name;
object_name = TRY(FlyString::from_utf8(library->name.view()));
symbol = library->symbolicate(ptr, &offset);
} else {
symbol = ByteString::formatted("?? <{:p}>", ptr);
Expand Down Expand Up @@ -681,7 +681,7 @@ ProfileNode::ProfileNode(Process const& process)
{
}

ProfileNode::ProfileNode(Process const& process, DeprecatedFlyString const& object_name, ByteString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid)
ProfileNode::ProfileNode(Process const& process, FlyString const& object_name, ByteString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid)
: m_process(process)
, m_symbol(move(symbol))
, m_pid(pid)
Expand All @@ -690,12 +690,12 @@ ProfileNode::ProfileNode(Process const& process, DeprecatedFlyString const& obje
, m_timestamp(timestamp)
{
ByteString object;
if (object_name.ends_with(": .text"sv)) {
object = object_name.view().substring_view(0, object_name.length() - 7);
if (object_name.ends_with_bytes(": .text"sv)) {
object = object_name.bytes_as_string_view().substring_view(0, object_name.bytes().size() - 7);
} else {
object = object_name;
object = ByteString::from_utf8(object_name.bytes()).release_value_but_fixme_should_propagate_errors();
}
m_object_name = LexicalPath::basename(object);
m_object_name = FlyString::from_utf8(object.view()).release_value_but_fixme_should_propagate_errors();
}

}
14 changes: 7 additions & 7 deletions Userland/DevTools/Profiler/Profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "SignpostsModel.h"
#include "SourceModel.h"
#include <AK/Bitmap.h>
#include <AK/DeprecatedFlyString.h>
#include <AK/FlyString.h>
#include <AK/JsonArray.h>
#include <AK/JsonObject.h>
#include <AK/JsonValue.h>
Expand All @@ -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, ByteString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid)
static NonnullRefPtr<ProfileNode> create(Process const& process, FlyString 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));
}
Expand All @@ -54,7 +54,7 @@ class ProfileNode : public RefCounted<ProfileNode> {
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); }

DeprecatedFlyString const& object_name() const { return m_object_name; }
FlyString const& object_name() const { return m_object_name; }
ByteString const& symbol() const { return m_symbol; }
FlatPtr address() const { return m_address; }
u32 offset() const { return m_offset; }
Expand All @@ -75,7 +75,7 @@ class ProfileNode : public RefCounted<ProfileNode> {
m_children.append(child);
}

ProfileNode& find_or_create_child(DeprecatedFlyString const& object_name, ByteString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid)
ProfileNode& find_or_create_child(FlyString 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];
Expand Down Expand Up @@ -113,12 +113,12 @@ class ProfileNode : public RefCounted<ProfileNode> {

private:
explicit ProfileNode(Process const&);
explicit ProfileNode(Process const&, DeprecatedFlyString const& object_name, ByteString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t);
explicit ProfileNode(Process const&, FlyString 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;
FlyString m_object_name;
ByteString m_symbol;
pid_t m_pid { 0 };
FlatPtr m_address { 0 };
Expand Down Expand Up @@ -167,7 +167,7 @@ class Profile {
Vector<NonnullRefPtr<ProfileNode>> const& roots() const { return m_roots; }

struct Frame {
DeprecatedFlyString object_name;
FlyString object_name;
ByteString symbol;
FlatPtr address { 0 };
u32 offset { 0 };
Expand Down