From: Frank Kardel Date: Sat, 27 May 2006 11:04:43 +0000 (+0000) Subject: monopt.html: X-Git-Tag: NTP_4_2_3P2~5^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8def5e61fbc74ffe9c346ec1c9b1ccd6e516152a;p=thirdparty%2Fntp.git monopt.html: 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 --- diff --git a/configure.ac b/configure.ac index 2581f5c3d..a4f5e8206 100644 --- a/configure.ac +++ b/configure.ac @@ -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]), diff --git a/html/monopt.html b/html/monopt.html index 3e3b2d989..17ef0b6c2 100644 --- a/html/monopt.html +++ b/html/monopt.html @@ -71,7 +71,7 @@
Number of packets discarded due to rate limitation.
timingstats -
ONLY available when the deamon is compiled with debugging support. Enables recording of ntpd processing time information for various selected code paths: +
ONLY available when the deamon is compiled with process time debugging support (--enable-debug-timing - costs performance). Enables recording of ntpd processing time information for various selected code paths:
53876 36.920 10.0.3.5 1 0.000014592 input processing delay
The first two fields show the date (Modified Julian Day) and time (seconds and fraction past UTC midnight). The next field is a potential peer address, - or -REFCLOCK- 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).
statsdir directory_path diff --git a/include/ntpd.h b/include/ntpd.h index 8d93f17ba..b9dd95d0b 100644 --- a/include/ntpd.h +++ b/include/ntpd.h @@ -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 */ diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c index f01a506af..c8f482843 100644 --- a/ntpd/ntp_io.c +++ b/ntpd/ntp_io.c @@ -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 diff --git a/ntpd/ntp_util.c b/ntpd/ntp_util.c index 7c100e622..434553cc4 100644 --- a/ntpd/ntp_util.c +++ b/ntpd/ntp_util.c @@ -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 * diff --git a/ntpd/ntpd.c b/ntpd/ntpd.c index a8ad81e7e..7b0e05cdf 100644 --- a/ntpd/ntpd.c +++ b/ntpd/ntpd.c @@ -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; }