machine: add variable CPU poll.
This commit is contained in:
parent
908721a720
commit
8a100e0bbf
|
@ -352,7 +352,7 @@ _cpu_state_get(cpu_core_t **cores, int ncpu)
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu_core_t **
|
cpu_core_t **
|
||||||
system_cpu_usage_get(int *ncpu)
|
system_cpu_usage_delayed_get(int *ncpu, int usecs)
|
||||||
{
|
{
|
||||||
cpu_core_t **cores;
|
cpu_core_t **cores;
|
||||||
int i;
|
int i;
|
||||||
|
@ -365,12 +365,18 @@ system_cpu_usage_get(int *ncpu)
|
||||||
cores[i] = calloc(1, sizeof(cpu_core_t));
|
cores[i] = calloc(1, sizeof(cpu_core_t));
|
||||||
|
|
||||||
_cpu_state_get(cores, *ncpu);
|
_cpu_state_get(cores, *ncpu);
|
||||||
usleep(1000000);
|
usleep(usecs);
|
||||||
_cpu_state_get(cores, *ncpu);
|
_cpu_state_get(cores, *ncpu);
|
||||||
|
|
||||||
return cores;
|
return cores;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cpu_core_t **
|
||||||
|
system_cpu_usage_get(int *ncpu)
|
||||||
|
{
|
||||||
|
return system_cpu_usage_delayed_get(ncpu, 1000000);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
static unsigned long
|
static unsigned long
|
||||||
_meminfo_parse_line(const char *line)
|
_meminfo_parse_line(const char *line)
|
||||||
|
|
|
@ -84,6 +84,9 @@ system_cpu_online_count_get();
|
||||||
cpu_core_t **
|
cpu_core_t **
|
||||||
system_cpu_usage_get(int *ncpu);
|
system_cpu_usage_get(int *ncpu);
|
||||||
|
|
||||||
|
cpu_core_t **
|
||||||
|
system_cpu_usage_delayed_get(int *ncpu, int usecs);
|
||||||
|
|
||||||
void
|
void
|
||||||
system_memory_usage_get(meminfo_t *memory);
|
system_memory_usage_get(meminfo_t *memory);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue