[PATCH] make top.c even smaller #3

Vladimir N. Oleynik dzo at simtreas.ru
Thu Feb 16 11:08:00 UTC 2006


I wrote:

> Denis Vlasenko wrote:
> 
>> +    FILE* fp = bb_xfopen("stat", "r");
>> +    prev_jif = jif;
>> +    if (fscanf(fp, "cpu  %lld %lld %lld %lld %lld %lld %lld %lld",
>> +            &jif.usr,&jif.nic,&jif.sys,&jif.idle,
>> +            &jif.iowait,&jif.irq,&jif.softirq,&jif.steal) < 4) {
>> +        bb_error_msg_and_die("failed to read 'stat'");
>>      }
>> +    fclose(fp);
>> +    jif.total = jif.usr + jif.nic + jif.sys + jif.idle
>> +            + jif.iowait + jif.irq + jif.softirq + jif.steal;
>> +    /* procps 2.x does not count iowait as busy time */

Also. Busybox`s top is port from procps-3.0.2.

> 2.4 kernel have only 4 number in first /proc/stat line.
> But you using all in formula.
> 
> Why you ignore my personal letters?


--w
vodz




More information about the busybox mailing list