Example #1
0
/*
 * Get CPU load periodically.
 */
void do_stat(void)
{
	read_cpu_stat(pl);
	calc_cpu_load(pl);
	cl[times] = pl->cpuload[cpu];
	if (quiet == 0)
		print_cpu_load(&(cl[times]));	/* print total results */
	times++;
}
Example #2
0
int 
get_cpu_usagetime(cpu_usagetime_t *usage)
{   
    stat_cputime_t stat;
    int rc = read_cpu_stat(&stat);
    if (rc < 0) {
        return -1;
    }
    cpu_usagetime_convrt(&stat, usage);
}
Example #3
0
int 
get_cpu_usagetime(cpu_usagetime_t *usage)
{   
    stat_cputime_t stat;
    int rc = read_cpu_stat(&stat);
    if (rc < 0) {
        fprintf(stderr, "%s\n", "fail to get cpu stat");
        return -1;
    }
    cpu_usagetime_convrt(&stat, usage);
    return 0;
}