This commit is contained in:
TheDarkBug 2021-10-14 22:48:08 +02:00
parent de28cf483d
commit 08e16edcaa

View file

@ -497,8 +497,8 @@ int read_cache()
void print_cache()
{
// ram
#ifndef __APPLE__
sysinfo(&sys); // to get uptime
#ifndef __CYGWIN__
FILE *meminfo;
@ -528,7 +528,7 @@ void print_cache()
#endif
#else
// Used
// Used ram
FILE *mem_wired_fp, *mem_active_fp, *mem_compressed_fp;
mem_wired_fp = popen("vm_stat | awk '/wired/ { printf $4 }' | cut -d '.' -f 1", "r");
mem_active_fp = popen("vm_stat | awk '/active/ { printf $3 }' | cut -d '.' -f 1", "r");
@ -552,13 +552,11 @@ void print_cache()
int mem_active = atoi(mem_active_ch);
int mem_compressed = atoi(mem_compressed_ch);
// Total
// Total ram
sysctlbyname("hw.memsize", &mem_buffer, &mem_buffer_len, NULL, 0);
ram_used = ((mem_wired + mem_active + mem_compressed) * 4 / 1024);
#endif
sysinfo(&sys); // to get uptime
#endif
print_ascii();
print_info();