* Gersh <[EMAIL PROTECTED]> [010327 13:41] wrote:
> Ive writen a quick patch for dev/ata/ata-disk.c:addump under
> 4.0-stable (03/26/01) which is considerbally faster.
> 
> I did dumps on a SMP system with 512 megs of ram.
> 
> Old:  201 seconds.
> New:   59 seconds.
> 
> What I could gather from talking to people over irc/email about the
> problem was that there was a DELAY(1000) in between each printf
> to deal with problems with serial connections to the debugger.  The
> soultion I came up with simply to display a smaller ammount of printf's
> the output looks like this:
> 
> Dump in progress, percentage complete: 10 20 30 40 50 60 70 80 100.  Done.
> 
> The dump_stats() routine probally belongs in some kern/subr_whatever.c
> and should probally be used in the other dump routines for da/ide etc.
> 
> Any thoughts or comments ?

Nice!  What about adapting it to scsi as well?

btw:

this is bad:

> +int
> +dump_stats(count, total, state)
> +     int count;
> +     int total;
> +     int *state;
> +{
> +     switch (*state)
> +     {
> +         case 0:
> +             if (count > 10)
> +                 *state = 10;
> +         break;
> +
> +         case 10:

it could be replaced with:

if (count % 10)
        printf("%d ", count);

inlined?

basically you want to print every % right?

If you want to make it look "kewl" do this:

printf("percentage complete:\n");


while (in loop)

   if (count % 10)
       printf("%d%%\r", count); 




-- 
-Alfred Perlstein - [[EMAIL PROTECTED]|[EMAIL PROTECTED]]
Represent yourself, show up at BABUG http://www.babug.org/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to