diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-07-01 18:43:01 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-07-01 18:43:01 +0200 |
commit | aaedc24f1561da83bc85471ccc0efa2651399a3f (patch) | |
tree | 5ce41d3ac1216b46a086ce62322940453a6c93a9 /Kernel/FileSystem | |
parent | 438a14c597c49df6238ae64b2869cca3d59aa142 (diff) | |
download | serenity-aaedc24f1561da83bc85471ccc0efa2651399a3f.zip |
Kernel+ProcessManager: Convert /proc/memstat to JSON.
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r-- | Kernel/FileSystem/ProcFS.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index e38ccf1002..e5e1cc4e4c 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -566,18 +566,17 @@ ByteBuffer procfs$summary(InodeIdentifier) ByteBuffer procfs$memstat(InodeIdentifier) { InterruptDisabler disabler; - StringBuilder builder(128); - builder.appendf("%u,%u,%u,%u,%u,%u,%u,%u,%u\n", - kmalloc_sum_eternal, - sum_alloc, - sum_free, - MM.user_physical_pages_used(), - MM.user_physical_pages() - MM.user_physical_pages_used(), - MM.super_physical_pages_used(), - MM.super_physical_pages() - MM.super_physical_pages_used(), - g_kmalloc_call_count, - g_kfree_call_count); - return builder.to_byte_buffer(); + JsonObject json; + json.set("kmalloc_allocated", sum_alloc); + json.set("kmalloc_available", sum_free); + json.set("kmalloc_eternal_allocated", kmalloc_sum_eternal); + json.set("user_physical_allocated", MM.user_physical_pages_used()); + json.set("user_physical_available", MM.user_physical_pages()); + json.set("super_physical_allocated", MM.super_physical_pages_used()); + json.set("super_physical_available", MM.super_physical_pages()); + json.set("kmalloc_call_count", g_kmalloc_call_count); + json.set("kfree_call_count", g_kfree_call_count); + return json.serialized().to_byte_buffer(); } ByteBuffer procfs$all(InodeIdentifier) |