mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
SystemMonitor: Highlight kernel processes a bit better in SystemMonitor
Kernel processes are now displayed with a gear icon and a "(*)" suffix in the process list.
This commit is contained in:
parent
ee2a1f5af7
commit
7b9754d976
2 changed files with 9 additions and 0 deletions
|
@ -57,6 +57,8 @@ ProcessModel::ProcessModel()
|
||||||
|
|
||||||
if (m_cpus.is_empty())
|
if (m_cpus.is_empty())
|
||||||
m_cpus.append(make<CpuInfo>(0));
|
m_cpus.append(make<CpuInfo>(0));
|
||||||
|
|
||||||
|
m_kernel_process_icon = GUI::Icon::default_icon("gear");
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessModel::~ProcessModel()
|
ProcessModel::~ProcessModel()
|
||||||
|
@ -261,6 +263,8 @@ GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
|
||||||
if (role == GUI::ModelRole::Display) {
|
if (role == GUI::ModelRole::Display) {
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
case Column::Icon: {
|
case Column::Icon: {
|
||||||
|
if (thread.current_state.kernel)
|
||||||
|
return m_kernel_process_icon;
|
||||||
auto icon = GUI::FileIconProvider::icon_for_executable(thread.current_state.executable).bitmap_for_size(16);
|
auto icon = GUI::FileIconProvider::icon_for_executable(thread.current_state.executable).bitmap_for_size(16);
|
||||||
if (!icon)
|
if (!icon)
|
||||||
return GUI::Icon();
|
return GUI::Icon();
|
||||||
|
@ -299,6 +303,8 @@ GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
|
||||||
case Column::Processor:
|
case Column::Processor:
|
||||||
return thread.current_state.cpu;
|
return thread.current_state.cpu;
|
||||||
case Column::Name:
|
case Column::Name:
|
||||||
|
if (thread.current_state.kernel)
|
||||||
|
return String::formatted("{} (*)", thread.current_state.name);
|
||||||
return thread.current_state.name;
|
return thread.current_state.name;
|
||||||
case Column::Syscalls:
|
case Column::Syscalls:
|
||||||
return thread.current_state.syscall_count;
|
return thread.current_state.syscall_count;
|
||||||
|
@ -348,6 +354,7 @@ void ProcessModel::update()
|
||||||
for (auto& it : all_processes.value()) {
|
for (auto& it : all_processes.value()) {
|
||||||
for (auto& thread : it.value.threads) {
|
for (auto& thread : it.value.threads) {
|
||||||
ThreadState state;
|
ThreadState state;
|
||||||
|
state.kernel = it.value.kernel;
|
||||||
state.pid = it.value.pid;
|
state.pid = it.value.pid;
|
||||||
state.user = it.value.username;
|
state.user = it.value.username;
|
||||||
state.pledge = it.value.pledge;
|
state.pledge = it.value.pledge;
|
||||||
|
|
|
@ -109,6 +109,7 @@ private:
|
||||||
pid_t sid;
|
pid_t sid;
|
||||||
unsigned ticks_user;
|
unsigned ticks_user;
|
||||||
unsigned ticks_kernel;
|
unsigned ticks_kernel;
|
||||||
|
bool kernel;
|
||||||
String executable;
|
String executable;
|
||||||
String name;
|
String name;
|
||||||
String state;
|
String state;
|
||||||
|
@ -146,4 +147,5 @@ private:
|
||||||
NonnullOwnPtrVector<CpuInfo> m_cpus;
|
NonnullOwnPtrVector<CpuInfo> m_cpus;
|
||||||
Vector<int> m_tids;
|
Vector<int> m_tids;
|
||||||
RefPtr<Core::File> m_proc_all;
|
RefPtr<Core::File> m_proc_all;
|
||||||
|
GUI::Icon m_kernel_process_icon;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue