mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
SystemMonitor: Add a utilization graph for each processor
This commit is contained in:
parent
d99901660d
commit
cdc78515b6
3 changed files with 87 additions and 16 deletions
|
@ -27,6 +27,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NonnullOwnPtrVector.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGUI/Model.h>
|
||||
|
@ -49,6 +50,7 @@ public:
|
|||
Icon = 0,
|
||||
Name,
|
||||
CPU,
|
||||
Processor,
|
||||
State,
|
||||
Priority,
|
||||
EffectivePriority,
|
||||
|
@ -87,7 +89,21 @@ public:
|
|||
virtual GUI::Variant data(const GUI::ModelIndex&, Role = Role::Display) const override;
|
||||
virtual void update() override;
|
||||
|
||||
Function<void(float)> on_new_cpu_data_point;
|
||||
struct CpuInfo
|
||||
{
|
||||
u32 id;
|
||||
float total_cpu_percent{0.0};
|
||||
HashMap<String, String> values;
|
||||
|
||||
CpuInfo(u32 id):
|
||||
id(id)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
Function<void(const NonnullOwnPtrVector<CpuInfo>&)> on_cpu_info_change;
|
||||
|
||||
const NonnullOwnPtrVector<CpuInfo>& cpus() const { return m_cpus; }
|
||||
|
||||
private:
|
||||
ProcessModel();
|
||||
|
@ -101,6 +117,7 @@ private:
|
|||
String user;
|
||||
String pledge;
|
||||
String veil;
|
||||
u32 cpu;
|
||||
u32 priority;
|
||||
u32 effective_priority;
|
||||
size_t amount_virtual;
|
||||
|
@ -130,6 +147,7 @@ private:
|
|||
|
||||
HashMap<uid_t, String> m_usernames;
|
||||
HashMap<PidAndTid, NonnullOwnPtr<Thread>> m_threads;
|
||||
NonnullOwnPtrVector<CpuInfo> m_cpus;
|
||||
Vector<PidAndTid> m_pids;
|
||||
RefPtr<Gfx::Bitmap> m_generic_process_icon;
|
||||
RefPtr<Gfx::Bitmap> m_high_priority_icon;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue