[PATCH] make top.c even smaller #3
Denis Vlasenko
vda at ilport.com.ua
Thu Feb 16 11:00:36 UTC 2006
On Thursday 16 February 2006 12:53, Vladimir N. Oleynik 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 */
>
> 2.4 kernel have only 4 number in first /proc/stat line.
> But you using all in formula.
fscanf will leave those variables unchanged, thus they will remain 0.
It will work just nice, at least I think so.
> Why you ignore my personal letters?
I replied to both your letters. Honest. Hmm, let me check qmail logs...
2006-02-13 05:44:21.85 starting delivery 6042: msg 427233 to remote dzo at simtreas.ru
2006-02-13 05:44:21.85 status: local 0/10 remote 2/10
2006-02-13 05:44:22.64 delivery 6042: deferral: Connected_to_195.9.147.3_but_greeting_failed./Remote_host_said:_554_treas.simtreas.ru_ESMTP_not_accepting_messages/
This may be a problem.
--
vda
More information about the busybox
mailing list