summaryrefslogtreecommitdiff
path: root/Libraries/LibCore
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-12-01 17:36:06 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-12-01 17:40:27 +0100
commit5a45376180fe589622a169828bb030eb929a509d (patch)
treea47ff74abdda552b28e7cb661c7c839fac9061a5 /Libraries/LibCore
parenta18aa8fd5f65708d840c5ff8c13f673ae4c8b079 (diff)
downloadserenity-5a45376180fe589622a169828bb030eb929a509d.zip
Kernel+SystemMonitor: Log amounts of I/O per thread
This patch adds these I/O counters to each thread: - (Inode) file read bytes - (Inode) file write bytes - Unix socket read bytes - Unix socket write bytes - IPv4 socket read bytes - IPv4 socket write bytes These are then exposed in /proc/all and seen in SystemMonitor.
Diffstat (limited to 'Libraries/LibCore')
-rw-r--r--Libraries/LibCore/CProcessStatisticsReader.cpp7
-rw-r--r--Libraries/LibCore/CProcessStatisticsReader.h6
2 files changed, 12 insertions, 1 deletions
diff --git a/Libraries/LibCore/CProcessStatisticsReader.cpp b/Libraries/LibCore/CProcessStatisticsReader.cpp
index 39f8db097e..39db980ee8 100644
--- a/Libraries/LibCore/CProcessStatisticsReader.cpp
+++ b/Libraries/LibCore/CProcessStatisticsReader.cpp
@@ -53,6 +53,12 @@ HashMap<pid_t, CProcessStatistics> CProcessStatisticsReader::get_all()
thread.inode_faults = thread_object.get("inode_faults").to_u32();
thread.zero_faults = thread_object.get("zero_faults").to_u32();
thread.cow_faults = thread_object.get("cow_faults").to_u32();
+ thread.unix_socket_read_bytes = thread_object.get("unix_socket_read_bytes").to_u32();
+ thread.unix_socket_write_bytes = thread_object.get("unix_socket_write_bytes").to_u32();
+ thread.ipv4_socket_read_bytes = thread_object.get("ipv4_socket_read_bytes").to_u32();
+ thread.ipv4_socket_write_bytes = thread_object.get("ipv4_socket_write_bytes").to_u32();
+ thread.file_read_bytes = thread_object.get("file_read_bytes").to_u32();
+ thread.file_write_bytes = thread_object.get("file_write_bytes").to_u32();
process.threads.append(move(thread));
});
@@ -78,4 +84,3 @@ String CProcessStatisticsReader::username_from_uid(uid_t uid)
return (*it).value;
return String::number(uid);
}
-
diff --git a/Libraries/LibCore/CProcessStatisticsReader.h b/Libraries/LibCore/CProcessStatisticsReader.h
index bb6da21d31..05e9e9659e 100644
--- a/Libraries/LibCore/CProcessStatisticsReader.h
+++ b/Libraries/LibCore/CProcessStatisticsReader.h
@@ -12,6 +12,12 @@ struct CThreadStatistics {
unsigned inode_faults;
unsigned zero_faults;
unsigned cow_faults;
+ unsigned unix_socket_read_bytes;
+ unsigned unix_socket_write_bytes;
+ unsigned ipv4_socket_read_bytes;
+ unsigned ipv4_socket_write_bytes;
+ unsigned file_read_bytes;
+ unsigned file_write_bytes;
String state;
String priority;
};