Whamcloud - gitweb
ChangeLog, e2fsck.h, unix.c:
authorTheodore Ts'o <tytso@mit.edu>
Sat, 12 Feb 2000 20:12:43 +0000 (20:12 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 12 Feb 2000 20:12:43 +0000 (20:12 +0000)
  unix.c (e2fsck_update_progress): Limit the number of updates to the
   progress bars to 8 times a second.  This allows a 9600 baud console
   link to keep up.

e2fsck/ChangeLog
e2fsck/e2fsck.h
e2fsck/unix.c

index 89c2133..e783b94 100644 (file)
@@ -1,3 +1,9 @@
+2000-02-12    <tytso@snap.thunk.org>
+
+       * unix.c (e2fsck_update_progress): Limit the number of updates to
+               the progress bars to 8 times a second.  This allows a 9600
+               baud console link to keep up.
+
 2000-02-11    <tytso@snap.thunk.org>
 
        * unix.c (main): If compression is enabled on the filesystem,
index 28f2a90..b0ba043 100644 (file)
@@ -219,6 +219,7 @@ struct e2fsck_struct {
        int progress_fd;
        int progress_pos;
        int progress_last_percent;
+       unsigned int progress_last_time;
 
        /* File counts */
        int fs_directory_count;
index 9696a77..16c9491 100644 (file)
@@ -325,6 +325,8 @@ static int e2fsck_update_progress(e2fsck_t ctx, int pass,
        char buf[80];
        int     i;
        float percent;
+       int     tick;
+       struct timeval  tv;
 
        if (pass == 0)
                return 0;
@@ -335,6 +337,12 @@ static int e2fsck_update_progress(e2fsck_t ctx, int pass,
        } else {
                if (ctx->flags & E2F_FLAG_PROG_SUPPRESS)
                        return 0;
+               gettimeofday(&tv, NULL);
+               tick = (tv.tv_sec << 3) + (tv.tv_usec / (1000000 / 8));
+               if ((tick == ctx->progress_last_time) &&
+                   (cur != max) && (cur != 0))
+                       return 0;
+               ctx->progress_last_time = tick;
                ctx->progress_pos = (ctx->progress_pos+1) & 3;
                ctx->flags |= E2F_FLAG_PROG_BAR;
                percent = calc_percent(&e2fsck_tbl, pass, cur, max);