Date: Mon, 25 Mar 2013 00:57:20 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Bruce Evans <brde@optusnet.com.au> Cc: svn-src-head@freebsd.org, Sean Bruno <sbruno@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r248680 - head/sbin/fsck_ffs Message-ID: <20130325003122.N1398@besplex.bde.org> In-Reply-To: <20130324232715.L959@besplex.bde.org> References: <201303241041.r2OAfTr1033109@svn.freebsd.org> <20130324232715.L959@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 24 Mar 2013, Bruce Evans wrote: > ... >> - printf("%21s:%8ld %2ld.%ld%% %4ld.%03ld sec %2lld.%lld%%\n", >> + printf("%21s:%8ld %2ld.%ld%% %4jd.%03ld sec %2lld.%lld%%\n", >> buftype[i], readcnt[i], readcnt[i] * 100 / diskreads, >> (readcnt[i] * 1000 / diskreads) % 10, >> - readtime[i].tv_sec, readtime[i].tv_nsec / 1000000, >> + (intmax_t)readtime[i].tv_sec, readtime[i].tv_nsec / >> 1000000, >> msec * 100 / totalmsec, (msec * 1000 / totalmsec) % 10); > ... > I don't like the poor man's floating point calculations. Everything is > easier using floating point. Don't say that this would use too many resources on embedded systems :-). In FreeBSD-2, fsck_ffs has always used floating point for printing the percentages in its primary statistics (the % fragmentation lines that are printed for every file system checked by fsck_ffs). This wasn't in 4.4BSD (poor man's floating point calculations are used there too), but it was one of the first things changed in FreeBSD-2 in 1994. The FreeBSD version used a remnant of the poor man's floating point calculations at first (a decimal multiplication by 100) at first, but I changed it in 1997 to do a floating point multiplication. The decimal multiplication could have overflowed with today's sized disk on ffs1 (this takes 21+ million frags). Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130325003122.N1398>