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

top: Remove some unused code.

This commit is contained in:
Andreas Kling 2019-07-10 15:15:10 +02:00
parent 01216f3c3f
commit ea6363c540

View file

@ -5,16 +5,12 @@
#include <AK/JsonValue.h> #include <AK/JsonValue.h>
#include <AK/QuickSort.h> #include <AK/QuickSort.h>
#include <AK/Vector.h> #include <AK/Vector.h>
#include <LibCore/CFile.h>
#include <LibCore/CProcessStatisticsReader.h> #include <LibCore/CProcessStatisticsReader.h>
#include <fcntl.h> #include <fcntl.h>
#include <pwd.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
static HashMap<unsigned, String>* s_usernames;
struct ProcessData { struct ProcessData {
CProcessStatistics stats; CProcessStatistics stats;
unsigned nsched_since_prev { 0 }; unsigned nsched_since_prev { 0 };
@ -29,12 +25,6 @@ struct Snapshot {
static Snapshot get_snapshot() static Snapshot get_snapshot()
{ {
CFile file("/proc/all");
if (!file.open(CIODevice::ReadOnly)) {
fprintf(stderr, "Failed to open /proc/all: %s\n", file.error_string());
exit(1);
}
Snapshot snapshot; Snapshot snapshot;
auto all_processes = CProcessStatisticsReader::get_all(); auto all_processes = CProcessStatisticsReader::get_all();
@ -52,12 +42,6 @@ static Snapshot get_snapshot()
int main(int, char**) int main(int, char**)
{ {
s_usernames = new HashMap<unsigned, String>();
setpwent();
while (auto* passwd = getpwent())
s_usernames->set(passwd->pw_uid, passwd->pw_name);
endpwent();
Vector<ProcessData*> processes; Vector<ProcessData*> processes;
auto prev = get_snapshot(); auto prev = get_snapshot();
usleep(10000); usleep(10000);