fixed incorrect cpu usage

While (as for manual) correct size of cpu states variable sould be 64 bits,
the systctl actually return 32 bits for kern.cp_time.
This commit is contained in:
Pawel "l0ner" Soltys 2015-01-11 18:01:13 +01:00
parent dba56f1b56
commit df5d66fdbf

@ -18,14 +18,15 @@
// Based on: Apple.cpp for load_string/mem_string and apple's documentation
#include <sys/types.h>
#include <unistd.h> // usleep
#include "common.h"
#include "cpu.h"
float cpu_percentage(unsigned int cpu_usage_delay)
{
int64_t load1[CPUSTATES];
int64_t load2[CPUSTATES];
int32_t load1[CPUSTATES];
int32_t load2[CPUSTATES];
GETSYSCTL("kern.cp_time", load1);
usleep(cpu_usage_delay);