Files
fastfetch/src/detection/memory/memory_bsd.c
T

18 lines
562 B
C
Raw Normal View History

2022-09-19 22:23:31 +02:00
#include "memory.h"
2022-09-19 23:16:43 +02:00
#include "common/sysctl.h"
2022-09-19 22:23:31 +02:00
void ffDetectMemoryImpl(FFMemoryResult* memory)
{
2022-09-20 11:16:08 +02:00
uint32_t pageSize = (uint32_t) ffSysctlGetInt("hw.pagesize", 0);
memory->ram.bytesTotal = (uint64_t) ffSysctlGetInt64("vm.stats.vm.v_page_count", 0) * pageSize;
memory->ram.bytesUsed = memory->ram.bytesTotal
- (uint64_t) ffSysctlGetInt64("vm.stats.vm.v_free_count", 0) * pageSize
- (uint64_t) ffSysctlGetInt64("vm.stats.vm.v_inactive_count", 0) * pageSize
;
2022-09-19 23:16:43 +02:00
2022-09-19 22:23:31 +02:00
memory->swap.bytesTotal = 0;
memory->swap.bytesUsed = 0;
}