]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
monopt.html:
authorFrank Kardel <kardel@ntp.org>
Sat, 27 May 2006 11:04:43 +0000 (11:04 +0000)
committerFrank Kardel <kardel@ntp.org>
Sat, 27 May 2006 11:04:43 +0000 (11:04 +0000)
  document conditional nature of process timing debugging
ntpd.c:
  make process timing debug conditional
  cleanup conditional compilation
ntp_util.c, ntp_io.c:
  make process timing debug conditional
ntpd.h:
  cleanup conditional compile cruft in ntpd.c by defining a macro
configure.ac:
  make process timing debug code conditional (default off)

bk: 4478324b48uFKioFEuM-Jnc68vk6yA

configure.ac
html/monopt.html
include/ntpd.h
ntpd/ntp_io.c
ntpd/ntp_util.c
ntpd/ntpd.c

index 2581f5c3d00100b1ebf138e058bdb45d40f34a7a..a4f5e820670d482e26e019140b22f7937bb6c240 100644 (file)
@@ -1715,6 +1715,15 @@ if test "$ntp_ok" = "yes"; then
 fi
 AC_MSG_RESULT($ntp_ok)
 
+AC_MSG_CHECKING(if we including processing time debugging code)
+AC_ARG_ENABLE(debug-timing,
+   AC_HELP_STRING([--enable-debug-timing], [- include processing time debugging code (costs performance)]),
+    [ntp_ok=$enableval], [ntp_ok=no])
+if test "$ntp_ok" = "yes"; then
+    AC_DEFINE(DEBUG_TIMING, 1, [Enable processing time debugging?])
+fi
+AC_MSG_RESULT($ntp_ok)
+
 AC_MSG_CHECKING(for a the number of minutes in a DST adjustment)
 AC_ARG_ENABLE(dst_minutes,
    AC_HELP_STRING([--enable-dst-minutes=60], [+ minutes per DST adjustment]),
index 3e3b2d9899a5a1524a394a164a441fbeb462fc6c..17ef0b6c285015b34ccd49dc08489c8d2b836656 100644 (file)
@@ -71,7 +71,7 @@
                                                        <dd>Number of packets discarded due to rate limitation.
                                                </dl>
                                        <dt><tt>timingstats</tt>
-                                       <dd><b>ONLY</b> available when the deamon is compiled with debugging support. Enables recording of <tt>ntpd</tt> processing time information for various selected code paths:
+                                       <dd><b>ONLY</b> available when the deamon is compiled with process time debugging support (--enable-debug-timing - costs performance). Enables recording of <tt>ntpd</tt> processing time information for various selected code paths:
                                        <dd><tt>53876 36.920 10.0.3.5 1 0.000014592 input processing delay</tt>
                                        <dd>The first two fields show the date (Modified Julian Day) and time (seconds and fraction past UTC midnight). The next field is a potential <tt>peer address</tt>, <tt>-</tt> or <tt>-REFCLOCK-</tt> depending on the associated io source. Then an event count for the number of processed events in the code path follows. The fifth field is the total time spend for the events. The rest of the line denotes the code path description (see source for more information).
                                        <dt><tt>statsdir <i>directory_path</i></tt>
index 8d93f17ba7cd41e2ede326f54d230afc242d483d..b9dd95d0b09c812fbd7fcaa1ff0a1b98ebaca3b2 100644 (file)
@@ -99,6 +99,11 @@ extern  void    collect_timing  P((struct recvbuf *, const char *, int, l_fp *))
 extern void    wait_for_signal P((void));
 extern void    unblock_io_and_alarm P((void));
 extern void    block_io_and_alarm P((void));
+#define UNBLOCK_IO_AND_ALARM() unblock_io_and_alarm()
+#define BLOCK_IO_AND_ALARM() block_io_and_alarm()
+#else
+#define UNBLOCK_IO_AND_ALARM()
+#define BLOCK_IO_AND_ALARM()
 #endif
 
 /* ntp_leap.c */
index f01a506af5b3c2a007bca89e1495573f176a3080..c8f482843b9e265578d7db2a19ca7d6dbe95b2d2 100644 (file)
@@ -310,7 +310,7 @@ static int move_fd(int fd)
 }
 #endif
 
-#ifdef DEBUG
+#ifdef DEBUG_TIMING
 /*
  * collect timing information for various processing
  * paths. currently we only pass then on to the file
@@ -2635,12 +2635,14 @@ read_network_packet(SOCKET fd, struct interface *itf, l_fp ts)
                        DPRINTF(2, ("input_handler: system network time stamp: %ld.%06ld\n", tvp->tv_sec, tvp->tv_usec));
                        nts.l_i = tvp->tv_sec + JAN_1970;
                        dtemp = tvp->tv_usec / 1e6;
-                       /* fuzz lower bits not covered by precision */
-                       if (sys_precision != 0)
-                               dtemp += (ntp_random() / FRAC - .5) / (1 <<
-                                                                      -sys_precision);
+
+                       /* fuzz lower bits not covered by precision */
+                       if (sys_precision != 0)
+                               dtemp += (ntp_random() / FRAC - .5) / (1 <<
+                                                                      -sys_precision);
+
                        nts.l_uf = (u_int32)(dtemp*FRAC);
-#ifdef DEBUG
+#ifdef DEBUG_TIMING
                        {
                                l_fp dts = ts;
                                L_SUB(&dts, &nts);
@@ -2850,7 +2852,7 @@ input_handler(
                return;
        }
                /* We've done our work */
-#ifdef DEBUG
+#ifdef DEBUG_TIMING
        get_systime(&ts_e);
        /*
         * (ts_e - ts) is the amount of time we spent
index 7c100e6226b8428a9a3ac4bee9d136ce8e4245db..434553cc43494a7ac52b1310e17f482c3393fd18 100644 (file)
@@ -79,7 +79,7 @@ static FILEGEN loopstats;
 static FILEGEN clockstats;
 static FILEGEN rawstats;
 static FILEGEN sysstats;
-#ifdef DEBUG
+#ifdef DEBUG_TIMING
 static FILEGEN timingstats;
 #endif
 #ifdef OPENSSL
@@ -121,7 +121,7 @@ init_util(void)
        filegen_register(&statsdir[0], "cryptostats", &cryptostats);
 #endif /* OPENSSL */
 
-#ifdef DEBUG
+#ifdef DEBUG_TIMING
        filegen_register(&statsdir[0], "timingstats", &timingstats);
 #endif
 }
@@ -654,7 +654,7 @@ record_crypto_stats(
 }
 #endif /* OPENSSL */
 
-#ifdef DEBUG
+#ifdef DEBUG_TIMING
 /*
  * record_crypto_stats - write crypto statistics to file
  *
index a8ad81e7e75ee32154b1d6bba7ec131b7c49ccea..7b0e05cdfe3cc88745537fd3577919791e09ca9f 100644 (file)
@@ -875,9 +875,7 @@ getgroup:
                int tot_full_recvbufs = GetReceivedBuffers();
 #else /* normal I/O */
 
-#if defined(HAVE_SIGNALED_IO)
-       block_io_and_alarm();
-# endif
+       BLOCK_IO_AND_ALARM();
        was_alarmed = 0;
        for (;;)
        {
@@ -942,23 +940,19 @@ getgroup:
 
                if (was_alarmed)
                {
-# ifdef HAVE_SIGNALED_IO
-                       unblock_io_and_alarm();
-# endif /* HAVE_SIGNALED_IO */
+                       UNBLOCK_IO_AND_ALARM();
                        /*
                         * Out here, signals are unblocked.  Call timer routine
                         * to process expiry.
                         */
                        timer();
                        was_alarmed = 0;
-# ifdef HAVE_SIGNALED_IO
-                        block_io_and_alarm();
-# endif /* HAVE_SIGNALED_IO */
+                        BLOCK_IO_AND_ALARM();
                }
 
 #endif /* HAVE_IO_COMPLETION_PORT */
 
-#ifdef DEBUG
+#ifdef DEBUG_TIMING
                {
                        l_fp pts;
                        l_fp tsa, tsb;
@@ -970,16 +964,15 @@ getgroup:
                        rbuf = get_full_recv_buffer();
                        while (rbuf != NULL)
                        {
-# ifdef HAVE_SIGNALED_IO
-                               unblock_io_and_alarm();
-# endif /* HAVE_SIGNALED_IO */
+                               UNBLOCK_IO_AND_ALARM();
+
                                /*
                                 * Call the data procedure to handle each received
                                 * packet.
                                 */
                                if (rbuf->receiver != NULL)     /* This should always be true */
                                {
-#ifdef DEBUG
+#ifdef DEBUG_TIMING
                                        l_fp dts = pts;
 
                                        L_SUB(&dts, &rbuf->recv_time);
@@ -992,13 +985,12 @@ getgroup:
                                        msyslog(LOG_ERR, "receive buffer corruption - receiver found to be NULL - ABORTING");
                                        abort();
                                }
-# ifdef HAVE_SIGNALED_IO
-                               block_io_and_alarm();
-# endif /* HAVE_SIGNALED_IO */
+
+                               BLOCK_IO_AND_ALARM();
                                freerecvbuf(rbuf);
                                rbuf = get_full_recv_buffer();
                        }
-#ifdef DEBUG
+#ifdef DEBUG_TIMING
                        get_systime(&tsb);
                        L_SUB(&tsb, &tsa);
                        if (bufcount) {
@@ -1012,9 +1004,7 @@ getgroup:
                 * Go around again
                 */
        }
-# ifdef HAVE_SIGNALED_IO
-       unblock_io_and_alarm();
-# endif /* HAVE_SIGNALED_IO */
+       UNBLOCK_IO_AND_ALARM();
        return 1;
 }