mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:17:44 +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
|
@ -26,7 +26,7 @@ public:
|
|||
struct ValueFormat {
|
||||
Gfx::ColorRole graph_color_role { Gfx::ColorRole::Base };
|
||||
Color text_shadow_color { Color::Transparent };
|
||||
Function<String(u64)> text_formatter;
|
||||
Function<DeprecatedString(u64)> text_formatter;
|
||||
};
|
||||
void set_value_format(size_t index, ValueFormat&& format)
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget* graph)
|
|||
layout()->set_margins({ 8, 0, 0 });
|
||||
layout()->set_spacing(3);
|
||||
|
||||
auto build_widgets_for_label = [this](String const& description) -> RefPtr<GUI::Label> {
|
||||
auto build_widgets_for_label = [this](DeprecatedString const& description) -> RefPtr<GUI::Label> {
|
||||
auto& container = add<GUI::Widget>();
|
||||
container.set_layout<GUI::HorizontalBoxLayout>();
|
||||
container.set_fixed_size(275, 12);
|
||||
|
@ -75,7 +75,7 @@ void MemoryStatsWidget::set_graph_widget(GraphWidget& graph)
|
|||
m_graph = &graph;
|
||||
}
|
||||
|
||||
void MemoryStatsWidget::set_graph_widget_via_name(String name)
|
||||
void MemoryStatsWidget::set_graph_widget_via_name(DeprecatedString name)
|
||||
{
|
||||
m_graph_widget_name = move(name);
|
||||
if (!m_graph_widget_name.is_null()) {
|
||||
|
@ -91,7 +91,7 @@ void MemoryStatsWidget::set_graph_widget_via_name(String name)
|
|||
}
|
||||
}
|
||||
|
||||
String MemoryStatsWidget::graph_widget_name()
|
||||
DeprecatedString MemoryStatsWidget::graph_widget_name()
|
||||
{
|
||||
if (m_graph)
|
||||
return m_graph->name();
|
||||
|
@ -128,12 +128,12 @@ void MemoryStatsWidget::refresh()
|
|||
u64 physical_pages_in_use = physical_allocated;
|
||||
u64 total_userphysical_and_swappable_pages = physical_allocated + physical_committed + physical_uncommitted;
|
||||
|
||||
m_kmalloc_space_label->set_text(String::formatted("{}/{}", human_readable_size(kmalloc_allocated), human_readable_size(kmalloc_bytes_total)));
|
||||
m_physical_pages_label->set_text(String::formatted("{}/{}", human_readable_size(page_count_to_bytes(physical_pages_in_use)), human_readable_size(page_count_to_bytes(physical_pages_total))));
|
||||
m_physical_pages_committed_label->set_text(String::formatted("{}", human_readable_size(page_count_to_bytes(physical_committed))));
|
||||
m_kmalloc_count_label->set_text(String::formatted("{}", kmalloc_call_count));
|
||||
m_kfree_count_label->set_text(String::formatted("{}", kfree_call_count));
|
||||
m_kmalloc_difference_label->set_text(String::formatted("{:+}", kmalloc_call_count - kfree_call_count));
|
||||
m_kmalloc_space_label->set_text(DeprecatedString::formatted("{}/{}", human_readable_size(kmalloc_allocated), human_readable_size(kmalloc_bytes_total)));
|
||||
m_physical_pages_label->set_text(DeprecatedString::formatted("{}/{}", human_readable_size(page_count_to_bytes(physical_pages_in_use)), human_readable_size(page_count_to_bytes(physical_pages_total))));
|
||||
m_physical_pages_committed_label->set_text(DeprecatedString::formatted("{}", human_readable_size(page_count_to_bytes(physical_committed))));
|
||||
m_kmalloc_count_label->set_text(DeprecatedString::formatted("{}", kmalloc_call_count));
|
||||
m_kfree_count_label->set_text(DeprecatedString::formatted("{}", kfree_call_count));
|
||||
m_kmalloc_difference_label->set_text(DeprecatedString::formatted("{:+}", kmalloc_call_count - kfree_call_count));
|
||||
|
||||
// Because the initialization order of us and the graph is unknown, we might get a couple of updates where the graph widget lookup fails.
|
||||
// Therefore, we can retry indefinitely. (Should not be too much of a performance hit, as we don't update that often.)
|
||||
|
|
|
@ -22,8 +22,8 @@ public:
|
|||
|
||||
void set_graph_widget(GraphWidget& graph);
|
||||
|
||||
void set_graph_widget_via_name(String name);
|
||||
String graph_widget_name();
|
||||
void set_graph_widget_via_name(DeprecatedString name);
|
||||
DeprecatedString graph_widget_name();
|
||||
|
||||
void refresh();
|
||||
|
||||
|
@ -33,7 +33,7 @@ private:
|
|||
|
||||
GraphWidget* m_graph;
|
||||
// Is null if we have a valid graph
|
||||
String m_graph_widget_name {};
|
||||
DeprecatedString m_graph_widget_name {};
|
||||
RefPtr<GUI::Label> m_physical_pages_label;
|
||||
RefPtr<GUI::Label> m_physical_pages_committed_label;
|
||||
RefPtr<GUI::Label> m_kmalloc_space_label;
|
||||
|
|
|
@ -56,15 +56,15 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
|
|||
net_adapters_fields.empend("class_name", "Class", Gfx::TextAlignment::CenterLeft);
|
||||
net_adapters_fields.empend("mac_address", "MAC", Gfx::TextAlignment::CenterLeft);
|
||||
net_adapters_fields.empend("Link status", Gfx::TextAlignment::CenterLeft,
|
||||
[](JsonObject const& object) -> String {
|
||||
[](JsonObject const& object) -> DeprecatedString {
|
||||
if (!object.get("link_up"sv).as_bool())
|
||||
return "Down";
|
||||
|
||||
return String::formatted("{} Mb/s {}-duplex", object.get("link_speed"sv).to_i32(),
|
||||
return DeprecatedString::formatted("{} Mb/s {}-duplex", object.get("link_speed"sv).to_i32(),
|
||||
object.get("link_full_duplex"sv).as_bool() ? "full"sv : "half"sv);
|
||||
});
|
||||
net_adapters_fields.empend("IPv4", Gfx::TextAlignment::CenterLeft,
|
||||
[](JsonObject const& object) -> String {
|
||||
[](JsonObject const& object) -> DeprecatedString {
|
||||
return object.get("ipv4_address"sv).as_string_or(""sv);
|
||||
});
|
||||
net_adapters_fields.empend("packets_in", "Pkt In", Gfx::TextAlignment::CenterRight);
|
||||
|
|
|
@ -51,7 +51,7 @@ void ProcessFileDescriptorMapWidget::set_pid(pid_t pid)
|
|||
if (m_pid == pid)
|
||||
return;
|
||||
m_pid = pid;
|
||||
m_model->set_json_path(String::formatted("/proc/{}/fds", m_pid));
|
||||
m_model->set_json_path(DeprecatedString::formatted("/proc/{}/fds", m_pid));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget()
|
|||
Vector<GUI::JsonArrayModel::FieldSpec> pid_vm_fields;
|
||||
pid_vm_fields.empend(
|
||||
"Address", Gfx::TextAlignment::CenterLeft,
|
||||
[](auto& object) { return String::formatted("{:p}", object.get("address"sv).to_u64()); },
|
||||
[](auto& object) { return DeprecatedString::formatted("{:p}", object.get("address"sv).to_u64()); },
|
||||
[](auto& object) { return object.get("address"sv).to_u64(); });
|
||||
pid_vm_fields.empend("size", "Size", Gfx::TextAlignment::CenterRight);
|
||||
pid_vm_fields.empend("amount_resident", "Resident", Gfx::TextAlignment::CenterRight);
|
||||
|
@ -117,7 +117,7 @@ void ProcessMemoryMapWidget::set_pid(pid_t pid)
|
|||
if (m_pid == pid)
|
||||
return;
|
||||
m_pid = pid;
|
||||
m_json_model->set_json_path(String::formatted("/proc/{}/vm", pid));
|
||||
m_json_model->set_json_path(DeprecatedString::formatted("/proc/{}/vm", pid));
|
||||
}
|
||||
|
||||
void ProcessMemoryMapWidget::refresh()
|
||||
|
|
|
@ -71,7 +71,7 @@ int ProcessModel::column_count(GUI::ModelIndex const&) const
|
|||
return Column::__Count;
|
||||
}
|
||||
|
||||
String ProcessModel::column_name(int column) const
|
||||
DeprecatedString ProcessModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::Icon:
|
||||
|
@ -288,12 +288,12 @@ GUI::Variant ProcessModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol
|
|||
case Column::PurgeableNonvolatile:
|
||||
return human_readable_size(thread.current_state.amount_purgeable_nonvolatile);
|
||||
case Column::CPU:
|
||||
return String::formatted("{:.2}", thread.current_state.cpu_percent);
|
||||
return DeprecatedString::formatted("{:.2}", thread.current_state.cpu_percent);
|
||||
case Column::Processor:
|
||||
return thread.current_state.cpu;
|
||||
case Column::Name:
|
||||
if (thread.current_state.kernel)
|
||||
return String::formatted("{} (*)", thread.current_state.name);
|
||||
return DeprecatedString::formatted("{} (*)", thread.current_state.name);
|
||||
return thread.current_state.name;
|
||||
case Column::Command:
|
||||
return thread.current_state.command;
|
||||
|
@ -408,16 +408,16 @@ Vector<GUI::ModelIndex> ProcessModel::matches(StringView searching, unsigned fla
|
|||
return found_indices;
|
||||
}
|
||||
|
||||
static ErrorOr<String> try_read_command_line(pid_t pid)
|
||||
static ErrorOr<DeprecatedString> try_read_command_line(pid_t pid)
|
||||
{
|
||||
auto file = TRY(Core::Stream::File::open(String::formatted("/proc/{}/cmdline", pid), Core::Stream::OpenMode::Read));
|
||||
auto file = TRY(Core::Stream::File::open(DeprecatedString::formatted("/proc/{}/cmdline", pid), Core::Stream::OpenMode::Read));
|
||||
auto data = TRY(file->read_all());
|
||||
auto json = TRY(JsonValue::from_string(StringView { data.bytes() }));
|
||||
auto array = json.as_array().values();
|
||||
return String::join(" "sv, array);
|
||||
return DeprecatedString::join(" "sv, array);
|
||||
}
|
||||
|
||||
static String read_command_line(pid_t pid)
|
||||
static DeprecatedString read_command_line(pid_t pid)
|
||||
{
|
||||
auto string_or_error = try_read_command_line(pid);
|
||||
if (string_or_error.is_error()) {
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NonnullOwnPtrVector.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Model.h>
|
||||
|
@ -64,7 +64,7 @@ public:
|
|||
virtual int tree_column() const override { return Column::Name; }
|
||||
virtual int row_count(GUI::ModelIndex const&) const override;
|
||||
virtual int column_count(GUI::ModelIndex const&) const override;
|
||||
virtual String column_name(int column) const override;
|
||||
virtual DeprecatedString column_name(int column) 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 = {}) const override;
|
||||
virtual GUI::ModelIndex parent_index(GUI::ModelIndex const&) const override;
|
||||
|
@ -104,14 +104,14 @@ private:
|
|||
u64 time_user { 0 };
|
||||
u64 time_kernel { 0 };
|
||||
bool kernel { false };
|
||||
String executable { "" };
|
||||
String name { "" };
|
||||
String command { "" };
|
||||
DeprecatedString executable { "" };
|
||||
DeprecatedString name { "" };
|
||||
DeprecatedString command { "" };
|
||||
uid_t uid { 0 };
|
||||
String state { "" };
|
||||
String user { "" };
|
||||
String pledge { "" };
|
||||
String veil { "" };
|
||||
DeprecatedString state { "" };
|
||||
DeprecatedString user { "" };
|
||||
DeprecatedString pledge { "" };
|
||||
DeprecatedString veil { "" };
|
||||
u32 cpu { 0 };
|
||||
u32 priority { 0 };
|
||||
size_t amount_virtual { 0 };
|
||||
|
|
|
@ -35,7 +35,7 @@ void ProcessUnveiledPathsWidget::set_pid(pid_t pid)
|
|||
if (m_pid == pid)
|
||||
return;
|
||||
m_pid = pid;
|
||||
m_model->set_json_path(String::formatted("/proc/{}/unveil", m_pid));
|
||||
m_model->set_json_path(DeprecatedString::formatted("/proc/{}/unveil", m_pid));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
int row_count(GUI::ModelIndex const&) const override { return m_symbols.size(); };
|
||||
bool is_column_sortable(int) const override { return false; }
|
||||
|
||||
String column_name(int column) const override
|
||||
DeprecatedString column_name(int column) const override
|
||||
{
|
||||
switch (column) {
|
||||
case Column::Address:
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
auto& symbol = m_symbols[model_index.row()];
|
||||
switch (model_index.column()) {
|
||||
case Column::Address:
|
||||
return String::formatted("{:p}", symbol.address);
|
||||
return DeprecatedString::formatted("{:p}", symbol.address);
|
||||
case Column::Object:
|
||||
return symbol.object;
|
||||
case Column::Symbol:
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
auto percentage = index.data(GUI::ModelRole::Custom).to_i32();
|
||||
|
||||
auto data = index.data();
|
||||
String text;
|
||||
DeprecatedString text;
|
||||
if (data.is_string())
|
||||
text = data.as_string();
|
||||
Gfx::StylePainter::paint_progressbar(painter, rect, palette, 0, 100, percentage, text);
|
||||
|
@ -87,8 +87,8 @@ class UnavailableProcessWidget final : public GUI::Frame {
|
|||
public:
|
||||
virtual ~UnavailableProcessWidget() override = default;
|
||||
|
||||
String const& text() const { return m_text; }
|
||||
void set_text(String text)
|
||||
DeprecatedString const& text() const { return m_text; }
|
||||
void set_text(DeprecatedString text)
|
||||
{
|
||||
m_text = move(text);
|
||||
update();
|
||||
|
@ -110,7 +110,7 @@ private:
|
|||
painter.draw_text(frame_inner_rect(), text(), Gfx::TextAlignment::Center, palette().window_text(), Gfx::TextElision::Right);
|
||||
}
|
||||
|
||||
String m_text;
|
||||
DeprecatedString m_text;
|
||||
};
|
||||
|
||||
class StorageTabWidget final : public GUI::LazyWidget {
|
||||
|
@ -193,7 +193,7 @@ public:
|
|||
check(MS_AXALLOWED, "axallowed"sv);
|
||||
check(MS_NOREGULAR, "noregular"sv);
|
||||
if (builder.string_view().is_empty())
|
||||
return String("defaults");
|
||||
return DeprecatedString("defaults");
|
||||
return builder.to_string();
|
||||
});
|
||||
df_fields.empend("free_block_count", "Free blocks", Gfx::TextAlignment::CenterRight);
|
||||
|
@ -287,8 +287,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto process_model = ProcessModel::create();
|
||||
process_model->on_state_update = [&](int process_count, int thread_count) {
|
||||
statusbar->set_text(0, String::formatted("Processes: {}", process_count));
|
||||
statusbar->set_text(1, String::formatted("Threads: {}", thread_count));
|
||||
statusbar->set_text(0, DeprecatedString::formatted("Processes: {}", process_count));
|
||||
statusbar->set_text(1, DeprecatedString::formatted("Threads: {}", thread_count));
|
||||
};
|
||||
|
||||
auto& performance_widget = *tabwidget.find_descendant_of_type_named<GUI::Widget>("performance");
|
||||
|
@ -335,7 +335,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return pid_index.data().to_i32();
|
||||
};
|
||||
|
||||
auto selected_name = [&](ProcessModel::Column column) -> String {
|
||||
auto selected_name = [&](ProcessModel::Column column) -> DeprecatedString {
|
||||
if (process_table_view.selection().is_empty())
|
||||
return {};
|
||||
auto pid_index = process_table_view.model()->index(process_table_view.selection().first().row(), column, process_table_view.selection().first().parent());
|
||||
|
@ -347,7 +347,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
pid_t pid = selected_id(ProcessModel::Column::PID);
|
||||
if (pid == -1)
|
||||
return;
|
||||
auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to kill \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
|
||||
auto rc = GUI::MessageBox::show(window, DeprecatedString::formatted("Do you really want to kill \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
|
||||
if (rc == GUI::Dialog::ExecResult::Yes)
|
||||
kill(pid, SIGKILL);
|
||||
},
|
||||
|
@ -358,7 +358,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
pid_t pid = selected_id(ProcessModel::Column::PID);
|
||||
if (pid == -1)
|
||||
return;
|
||||
auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to stop \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
|
||||
auto rc = GUI::MessageBox::show(window, DeprecatedString::formatted("Do you really want to stop \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
|
||||
if (rc == GUI::Dialog::ExecResult::Yes)
|
||||
kill(pid, SIGSTOP);
|
||||
},
|
||||
|
@ -378,7 +378,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
pid_t pid = selected_id(ProcessModel::Column::PID);
|
||||
if (pid == -1)
|
||||
return;
|
||||
auto pid_string = String::number(pid);
|
||||
auto pid_string = DeprecatedString::number(pid);
|
||||
GUI::Process::spawn_or_show_error(window, "/bin/Profiler"sv, Array { "--pid", pid_string.characters() });
|
||||
},
|
||||
&process_table_view);
|
||||
|
@ -434,11 +434,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
frequency_action_group.set_exclusive(true);
|
||||
|
||||
auto make_frequency_action = [&](int seconds) {
|
||||
auto action = GUI::Action::create_checkable(String::formatted("&{} Sec", seconds), [&refresh_timer, seconds](auto&) {
|
||||
auto action = GUI::Action::create_checkable(DeprecatedString::formatted("&{} Sec", seconds), [&refresh_timer, seconds](auto&) {
|
||||
Config::write_i32("SystemMonitor"sv, "Monitor"sv, "Frequency"sv, seconds);
|
||||
refresh_timer.restart(seconds * 1000);
|
||||
});
|
||||
action->set_status_tip(String::formatted("Refresh every {} seconds", seconds));
|
||||
action->set_status_tip(DeprecatedString::formatted("Refresh every {} seconds", seconds));
|
||||
action->set_checked(frequency == seconds);
|
||||
frequency_action_group.add_action(*action);
|
||||
frequency_menu.add_action(*action);
|
||||
|
@ -506,7 +506,7 @@ ErrorOr<NonnullRefPtr<GUI::Window>> build_process_window(pid_t pid)
|
|||
{
|
||||
auto window = GUI::Window::construct();
|
||||
window->resize(480, 360);
|
||||
window->set_title(String::formatted("PID {} - System Monitor", pid));
|
||||
window->set_title(DeprecatedString::formatted("PID {} - System Monitor", pid));
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-system-monitor"sv);
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
@ -528,7 +528,7 @@ ErrorOr<NonnullRefPtr<GUI::Window>> build_process_window(pid_t pid)
|
|||
main_widget->find_descendant_of_type_named<GUI::Label>("icon_label")->set_icon(icon_data.as_icon().bitmap_for_size(32));
|
||||
}
|
||||
|
||||
main_widget->find_descendant_of_type_named<GUI::Label>("process_name")->set_text(String::formatted("{} (PID {})", process_index.sibling_at_column(ProcessModel::Column::Name).data().to_string(), pid));
|
||||
main_widget->find_descendant_of_type_named<GUI::Label>("process_name")->set_text(DeprecatedString::formatted("{} (PID {})", process_index.sibling_at_column(ProcessModel::Column::Name).data().to_string(), pid));
|
||||
|
||||
main_widget->find_descendant_of_type_named<SystemMonitor::ProcessStateWidget>("process_state")->set_pid(pid);
|
||||
main_widget->find_descendant_of_type_named<SystemMonitor::ProcessFileDescriptorMapWidget>("open_files")->set_pid(pid);
|
||||
|
@ -538,7 +538,7 @@ ErrorOr<NonnullRefPtr<GUI::Window>> build_process_window(pid_t pid)
|
|||
|
||||
auto& widget_stack = *main_widget->find_descendant_of_type_named<GUI::StackWidget>("widget_stack");
|
||||
auto& unavailable_process_widget = *widget_stack.find_descendant_of_type_named<SystemMonitor::UnavailableProcessWidget>("unavailable_process");
|
||||
unavailable_process_widget.set_text(String::formatted("Unable to access PID {}", pid));
|
||||
unavailable_process_widget.set_text(DeprecatedString::formatted("Unable to access PID {}", pid));
|
||||
|
||||
if (can_access_pid(pid))
|
||||
widget_stack.set_active_widget(widget_stack.find_descendant_of_type_named<GUI::TabWidget>("available_process"));
|
||||
|
@ -568,13 +568,13 @@ void build_performance_tab(GUI::Widget& graphs_container)
|
|||
cpu_graph.set_value_format(0, {
|
||||
.graph_color_role = ColorRole::SyntaxPreprocessorStatement,
|
||||
.text_formatter = [](u64 value) {
|
||||
return String::formatted("Total: {}%", value);
|
||||
return DeprecatedString::formatted("Total: {}%", value);
|
||||
},
|
||||
});
|
||||
cpu_graph.set_value_format(1, {
|
||||
.graph_color_role = ColorRole::SyntaxPreprocessorValue,
|
||||
.text_formatter = [](u64 value) {
|
||||
return String::formatted("Kernel: {}%", value);
|
||||
return DeprecatedString::formatted("Kernel: {}%", value);
|
||||
},
|
||||
});
|
||||
cpu_graphs.append(cpu_graph);
|
||||
|
@ -587,26 +587,26 @@ void build_performance_tab(GUI::Widget& graphs_container)
|
|||
sum_cpu += cpus[i].total_cpu_percent;
|
||||
}
|
||||
float cpu_usage = sum_cpu / (float)cpus.size();
|
||||
statusbar->set_text(2, String::formatted("CPU usage: {}%", (int)roundf(cpu_usage)));
|
||||
statusbar->set_text(2, DeprecatedString::formatted("CPU usage: {}%", (int)roundf(cpu_usage)));
|
||||
};
|
||||
|
||||
auto& memory_graph = *graphs_container.find_descendant_of_type_named<SystemMonitor::GraphWidget>("memory_graph");
|
||||
memory_graph.set_value_format(0, {
|
||||
.graph_color_role = ColorRole::SyntaxComment,
|
||||
.text_formatter = [](u64 bytes) {
|
||||
return String::formatted("Committed: {}", human_readable_size(bytes));
|
||||
return DeprecatedString::formatted("Committed: {}", human_readable_size(bytes));
|
||||
},
|
||||
});
|
||||
memory_graph.set_value_format(1, {
|
||||
.graph_color_role = ColorRole::SyntaxPreprocessorStatement,
|
||||
.text_formatter = [](u64 bytes) {
|
||||
return String::formatted("Allocated: {}", human_readable_size(bytes));
|
||||
return DeprecatedString::formatted("Allocated: {}", human_readable_size(bytes));
|
||||
},
|
||||
});
|
||||
memory_graph.set_value_format(2, {
|
||||
.graph_color_role = ColorRole::SyntaxPreprocessorValue,
|
||||
.text_formatter = [](u64 bytes) {
|
||||
return String::formatted("Kernel heap: {}", human_readable_size(bytes));
|
||||
return DeprecatedString::formatted("Kernel heap: {}", human_readable_size(bytes));
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue