1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:07:34 +00:00

Utilities: Add the memstat utility

This small utility is something we probably needed for a very long
time - a way to print memory statistics in an elegant manner.

This utility opens /sys/kernel/memstat, reads it and decode the values
into human readable entries, possibly even into human-readable sizes.
This commit is contained in:
Liav A 2023-06-25 22:17:28 +03:00 committed by Jelle Raaijmakers
parent b74cb569ec
commit 83ebd1882f
2 changed files with 106 additions and 0 deletions

View file

@ -0,0 +1,36 @@
## Name
memstat - show memory statistics
## Synopsis
```**sh
$ memstat
```
## Options
* `-h` , `--human-readable`: Print human-readable sizes
## Examples
```sh
$ memstat
Kmalloc allocated: 7894528/10979648
Physical pages (in use) count: 172249088/1016643584
Physical pages (committed) count: 125521920
Physical pages (uncommitted) count: 718872576
Physical pages (total) count: 248204
Kmalloc call count: 77475
Kfree call count: 59575
Kmalloc/Kfree delta: +17900
$ memstat -h
Kmalloc allocated: 7.5 MiB (7,908,928 bytes) / 10.4 MiB (10,978,624 bytes)
Physical pages (in use) count: 164.8 MiB (172,838,912 bytes) / 969.5 MiB (1,016,643,584 bytes)
Physical pages (committed) count: 119.6 MiB (125,485,056 bytes)
Physical pages (uncommitted) count: 685.0 MiB (718,319,616 bytes)
Physical pages (total) count: 248204
Kmalloc call count: 78714
Kfree call count: 60777
Kmalloc/Kfree delta: +17937
```