1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:57:45 +00:00

SystemMonitor: Remove some unused cruft in ProcessModel

This commit is contained in:
Andreas Kling 2021-02-16 20:24:22 +01:00
parent db694491f3
commit 5f81babad2
2 changed files with 3 additions and 17 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -25,15 +25,11 @@
*/ */
#include "ProcessModel.h" #include "ProcessModel.h"
#include "GraphWidget.h"
#include <AK/JsonArray.h>
#include <AK/JsonObject.h> #include <AK/JsonObject.h>
#include <AK/JsonValue.h> #include <AK/JsonValue.h>
#include <LibCore/File.h> #include <LibCore/File.h>
#include <LibCore/ProcessStatisticsReader.h> #include <LibCore/ProcessStatisticsReader.h>
#include <LibGUI/FileIconProvider.h> #include <LibGUI/FileIconProvider.h>
#include <fcntl.h>
#include <stdio.h>
static ProcessModel* s_the; static ProcessModel* s_the;
@ -48,9 +44,6 @@ ProcessModel::ProcessModel()
ASSERT(!s_the); ASSERT(!s_the);
s_the = this; s_the = this;
m_generic_process_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/gear.png"); m_generic_process_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/gear.png");
m_high_priority_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/highpriority.png");
m_low_priority_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/lowpriority.png");
m_normal_priority_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/normalpriority.png");
auto file = Core::File::construct("/proc/cpuinfo"); auto file = Core::File::construct("/proc/cpuinfo");
if (file->open(Core::IODevice::ReadOnly)) { if (file->open(Core::IODevice::ReadOnly)) {
@ -264,7 +257,6 @@ GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
return thread.current_state.veil; return thread.current_state.veil;
} }
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
return {};
} }
if (role == GUI::ModelRole::Display) { if (role == GUI::ModelRole::Display) {
@ -385,7 +377,6 @@ void ProcessModel::update()
state.tid = thread.tid; state.tid = thread.tid;
state.pgid = it.value.pgid; state.pgid = it.value.pgid;
state.sid = it.value.sid; state.sid = it.value.sid;
state.times_scheduled = thread.times_scheduled;
state.ticks_user = thread.ticks_user; state.ticks_user = thread.ticks_user;
state.ticks_kernel = thread.ticks_kernel; state.ticks_kernel = thread.ticks_kernel;
state.cpu = thread.cpu; state.cpu = thread.cpu;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -96,7 +96,7 @@ public:
float total_cpu_percent { 0.0 }; float total_cpu_percent { 0.0 };
float total_cpu_percent_kernel { 0.0 }; float total_cpu_percent_kernel { 0.0 };
CpuInfo(u32 id) explicit CpuInfo(u32 id)
: id(id) : id(id)
{ {
} }
@ -115,7 +115,6 @@ private:
pid_t ppid; pid_t ppid;
pid_t pgid; pid_t pgid;
pid_t sid; pid_t sid;
unsigned times_scheduled;
unsigned ticks_user; unsigned ticks_user;
unsigned ticks_kernel; unsigned ticks_kernel;
String executable; String executable;
@ -151,14 +150,10 @@ private:
ThreadState previous_state; ThreadState previous_state;
}; };
HashMap<uid_t, String> m_usernames;
HashMap<PidAndTid, NonnullOwnPtr<Thread>> m_threads; HashMap<PidAndTid, NonnullOwnPtr<Thread>> m_threads;
NonnullOwnPtrVector<CpuInfo> m_cpus; NonnullOwnPtrVector<CpuInfo> m_cpus;
Vector<PidAndTid> m_pids; Vector<PidAndTid> m_pids;
RefPtr<Gfx::Bitmap> m_generic_process_icon; RefPtr<Gfx::Bitmap> m_generic_process_icon;
RefPtr<Gfx::Bitmap> m_high_priority_icon;
RefPtr<Gfx::Bitmap> m_low_priority_icon;
RefPtr<Gfx::Bitmap> m_normal_priority_icon;
RefPtr<Core::File> m_proc_all; RefPtr<Core::File> m_proc_all;
}; };