[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parted 1.6.0-pre9

From: Richard Hirst
Subject: Re: Parted 1.6.0-pre9
Date: Tue, 16 Apr 2002 21:53:01 +0100
User-agent: Mutt/1.3.24i

On Sat, Apr 13, 2002 at 08:18:13AM +1000, Andrew Clausen wrote:
> > Actually, progress reporting is
> > pretty eratic on this dual processor ia64 box, with 2G memory.  When

The following line from ped_timer_update() is suspect:

             = timer->start + (timer->now - timer->start) / frac;

That is effectively "long = long + long/float", and on ia64 it appears
to evaluate it all as float.  float seems to only have 24 significant
bits, and as time() is bigger than that, predicted_end gets rounded.

Adding the following cast has the desired effect:

             = timer->start + (long)((timer->now - timer->start) / frac);

I know this problem doesn't occur on i386, and my K&R says floating
point arithmetic is all done in double precision, but I posted to the
ia64 m-l and was told it was valid for the compiler to evaluate as float
in this case.

Once I add that cast, the only problem I have is the status sitting at
100% for several seconds before being cleared.  I can 'fix' that by
moving the fflush(stdout) call in _timer_handler() like so:

                          tcontext->predicted_time_left / 60,
                          tcontext->predicted_time_left % 60);
-                 fflush (stdout);
                  if (timer->predicted_end == timer->now) {
                          wipe_line ();
                          tcontext->finished = 0;
+                 fflush (stdout);

Without that, the output of that wipe_line() call above just sits in the
output buffer until parted prompts again.  With that change, progress
increments to 100%, clears, and then there is a pause while the disk
chugs away, then a new (parted) prompt.  I got the impression the
progress line flickered more with that fflush() change, so maybe it is
better not to change it.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]