Source-Changes-HG archive

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

[src/trunk]: src/sys/lib/libsa Add a slow twiddle option. This speeds up a p...



details:   https://anonhg.NetBSD.org/src/rev/1507a4e63308
branches:  trunk
changeset: 939743:1507a4e63308
user:      simonb <simonb%NetBSD.org@localhost>
date:      Tue Sep 29 00:13:12 2020 +0000

description:
Add a slow twiddle option.  This speeds up a pmax netboot by 15% and
is only 1% slower than no twiddle.

diffstat:

 sys/lib/libsa/twiddle.c |  19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r cd5feeefb1cc -r 1507a4e63308 sys/lib/libsa/twiddle.c
--- a/sys/lib/libsa/twiddle.c   Mon Sep 28 23:31:18 2020 +0000
+++ b/sys/lib/libsa/twiddle.c   Tue Sep 29 00:13:12 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: twiddle.c,v 1.8 2008/04/30 16:18:09 ad Exp $   */
+/*     $NetBSD: twiddle.c,v 1.9 2020/09/29 00:13:12 simonb Exp $       */
 
 /*-
  * Copyright (c) 1993
@@ -40,13 +40,24 @@
 
 char   twiddle_toggle;
 
+#ifdef LIBSA_SLOW_TWIDDLE
+#define        TWIDDLE_DELAY   4
+#else
+#define        TWIDDLE_DELAY   0
+#endif
+
+#define        TWIDDLE_MASK    ((1 << TWIDDLE_DELAY) - 1)
+
 void
 twiddle(void)
 {
-       static int pos;
+       static unsigned int pos;
 
        if (!twiddle_toggle) {
-               putchar(TWIDDLE_CHARS[pos++ & 3]);
-               putchar('\b');
+               if ((pos & TWIDDLE_MASK) == 0) {
+                       putchar(TWIDDLE_CHARS[(pos >> TWIDDLE_DELAY) & 3]);
+                       putchar('\b');
+               }
+               pos++;
        }
 }



Home | Main Index | Thread Index | Old Index