mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Memory (macOS): adds debug info
Usage: `fastfetch -s memory:swap -l none --dynamic-interval 1000 --debug --no-buffer` See https://github.com/fastfetch-cli/fastfetch/issues/2171#issuecomment-3803309478
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "memory.h"
|
||||
#include "common/debug.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <mach/mach.h>
|
||||
@@ -21,11 +22,16 @@ const char* ffDetectMemory(FFMemoryResult* ram)
|
||||
return "Failed to read host_statistics64";
|
||||
|
||||
uint64_t pageSize = instance.state.platform.sysinfo.pageSize;
|
||||
uint64_t appMemory = vmstat.internal_page_count * pageSize;
|
||||
uint64_t appMemory = vmstat.internal_page_count * pageSize; // memory allocated by `mmap(..., MAP_ANON | MAP_PRIVATE, ...)`, i.e. malloc(3)
|
||||
uint64_t wiredMemory = vmstat.wire_count * pageSize;
|
||||
uint64_t compressed = vmstat.compressor_page_count * pageSize;
|
||||
uint64_t reserved = ram->bytesTotal - usableMemory;
|
||||
|
||||
FF_DEBUG("App: %.2f GiB", (double) appMemory / 1024. / 1024. / 1024.);
|
||||
FF_DEBUG("Wired: %.2f GiB", (double) wiredMemory / 1024. / 1024. / 1024.);
|
||||
FF_DEBUG("Compressed: %.2f GiB", (double) compressed / 1024. / 1024. / 1024.);
|
||||
FF_DEBUG("Reserved: %.2f GiB", (double) reserved / 1024. / 1024. / 1024.);
|
||||
|
||||
ram->bytesUsed = appMemory + wiredMemory + compressed + reserved;
|
||||
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user