void cal_occupy(struct occupy *, struct occupy *);
void get_occupy(struct occupy *);
struct occupy ocpu[10];
struct occupy ncpu[10];
int i;
cpu_num = sysconf(_SC_NPROCESSORS_ONLN);
for (i=0; i<cpu_num; i++)
cal_occupy(&ocpu[i], &ncpu[i]);
printf("%f ", g_cpu_used);
cal_occupy (struct occupy *o, struct occupy *n)
od = (double) (o->user + o->nice + o->system +
o->idle);
评论0
最新资源