mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
Kernel+LibCore: Add process creation time to /sys/kernel/processes
This commit is contained in:
parent
4d49852454
commit
f95dccdb45
3 changed files with 4 additions and 0 deletions
|
@ -83,6 +83,7 @@ ErrorOr<void> SysFSOverallProcesses::try_generate(KBufferBuilder& builder)
|
|||
}
|
||||
TRY(process.name().with([&](auto& process_name) { return process_object.add("name"sv, process_name->view()); }));
|
||||
TRY(process_object.add("executable"sv, process.executable() ? TRY(process.executable()->try_serialize_absolute_path())->view() : ""sv));
|
||||
TRY(process_object.add("creation_time"sv, process.creation_time().nanoseconds_since_epoch()));
|
||||
|
||||
size_t amount_virtual = 0;
|
||||
size_t amount_resident = 0;
|
||||
|
|
|
@ -42,6 +42,7 @@ ErrorOr<AllProcessesStatistics> ProcessStatisticsReader::get_all(SeekableStream&
|
|||
process.tty = process_object.get_deprecated_string("tty"sv).value_or("");
|
||||
process.pledge = process_object.get_deprecated_string("pledge"sv).value_or("");
|
||||
process.veil = process_object.get_deprecated_string("veil"sv).value_or("");
|
||||
process.creation_time = UnixDateTime::from_nanoseconds_since_epoch(process_object.get_i64("creation_time"sv).value_or(0));
|
||||
process.amount_virtual = process_object.get_u32("amount_virtual"sv).value_or(0);
|
||||
process.amount_resident = process_object.get_u32("amount_resident"sv).value_or(0);
|
||||
process.amount_shared = process_object.get_u32("amount_shared"sv).value_or(0);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Time.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -49,6 +50,7 @@ struct ProcessStatistics {
|
|||
DeprecatedString tty;
|
||||
DeprecatedString pledge;
|
||||
DeprecatedString veil;
|
||||
UnixDateTime creation_time;
|
||||
size_t amount_virtual;
|
||||
size_t amount_resident;
|
||||
size_t amount_shared;
|
||||
|
|
Loading…
Add table
Reference in a new issue