Lines 222-228
Link Here
|
222 |
/* special handling for CPU_ALL and CPU_ANY */ |
222 |
/* special handling for CPU_ALL and CPU_ANY */ |
223 |
if (c->cpu == CPU_ANY || c->cpu == CPU_ALL) { |
223 |
if (c->cpu == CPU_ANY || c->cpu == CPU_ALL) { |
224 |
for (i = 0; i < cinfo->cpus; i++) { |
224 |
for (i = 0; i < cinfo->cpus; i++) { |
225 |
clog(LOG_DEBUG, "CPU%d user=%d nice=%d sys=%d\n", c->cpu, |
225 |
clog(LOG_DEBUG, "CPU%d user=%d nice=%d sys=%d\n", i, |
226 |
cusage[i].c_user, cusage[i].c_nice, cusage[i].c_sys); |
226 |
cusage[i].c_user, cusage[i].c_nice, cusage[i].c_sys); |
227 |
cpu_percent = calculate_cpu_usage(&cusage[i], &cusage_old[i], c->nice_scale); |
227 |
cpu_percent = calculate_cpu_usage(&cusage[i], &cusage_old[i], c->nice_scale); |
228 |
clog(LOG_DEBUG, "CPU%d %d%% - min=%d max=%d scale=%.2f (%s)\n", i, cpu_percent, |
228 |
clog(LOG_DEBUG, "CPU%d %d%% - min=%d max=%d scale=%.2f (%s)\n", i, cpu_percent, |
Lines 234-247
Link Here
|
234 |
if (c->cpu == CPU_ALL && !(cpu_percent >= c->min && cpu_percent <= c->max)) |
234 |
if (c->cpu == CPU_ALL && !(cpu_percent >= c->min && cpu_percent <= c->max)) |
235 |
break; |
235 |
break; |
236 |
} |
236 |
} |
237 |
/* if this code is reached then either CPU_ANY and none matches |
237 |
/* if this code is reached then |
238 |
* or CPU_ALL and all match |
238 |
* either CPU_ANY and none matches |
|
|
239 |
* or CPU_ALL and all match, where i == cinfo->cpus |
240 |
* or CPU_ALL and break was called |
239 |
*/ |
241 |
*/ |
240 |
if (c->cpu == CPU_ANY) { |
242 |
if (c->cpu == CPU_ALL && i == cinfo->cpus) |
241 |
c = c->next; |
243 |
return MATCH; |
242 |
continue; |
244 |
|
243 |
} |
245 |
c = c->next; |
244 |
return MATCH; /*if (c->cpu == ALL)*/ |
246 |
continue; |
245 |
} |
247 |
} |
246 |
|
248 |
|
247 |
/* cacluate weighted activity for the requested CPU */ |
249 |
/* cacluate weighted activity for the requested CPU */ |