Subject: bin/900: dump estimates time poorly when waiting for user interaction
To: None <gnats-admin@NetBSD.ORG>
From: John Kohl <jtk@kolvir.blrc.ma.us>
List: netbsd-bugs
Date: 03/23/1995 20:20:04
>Number: 900
>Category: bin
>Synopsis: dump includes time waiting for operator in speed estimates
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Thu Mar 23 20:20:03 1995
>Originator: John Kohl
>Organization:
NetBSD Kernel Hackers `R` Us
>Release: NetBSD/i386 current, as of 1995/03/20
>Environment:
System: NetBSD kolvir 1.0A NetBSD 1.0A (KOLVIR) #145: Wed Mar 22 19:42:17 EST 1995 jtk@kolvir:/u1/NetBSD-current/src/sys/arch/i386/compile/KOLVIR i386
>Description:
Dump estimates time remaining to do its work. These estimates are based
on the amount of time elapsed since it wrote the first block. This
estimate will be inflated if the dump is waiting for operator input at a
volume change.
>How-To-Repeat:
Run dump onto small tapes, let it sit waiting for a tape change for a
long time, and then see the remaining time estimate be vastly
overinflated.
>Fix:
--- 1.1 1995/03/24 03:45:19
+++ src/sbin/dump/optr.c 1995/03/24 03:50:25
@@ -87,6 +87,9 @@
char replybuffer[64];
int back, errcount;
FILE *mytty;
+ time_t firstprompt, when_answered;
+
+ firstprompt = time((time_t *)0);
if ((mytty = fopen(_PATH_TTY, "r")) == NULL)
quit("fopen on %s fails: %s\n", _PATH_TTY, strerror(errno));
@@ -119,6 +122,13 @@
if (signal(SIGALRM, sig) == SIG_IGN)
signal(SIGALRM, SIG_IGN);
(void) fclose(mytty);
+ when_answered = time((time_t *)0);
+ /*
+ * Adjust the base for time estimates to ignore time we spent waiting
+ * for operator input.
+ */
+ if (tstart_writing != 0)
+ tstart_writing += (when_answered - firstprompt);
return(back);
}
>Audit-Trail:
>Unformatted: