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]),
<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>
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 */
}
#endif
-#ifdef DEBUG
+#ifdef DEBUG_TIMING
/*
* collect timing information for various processing
* paths. currently we only pass then on to the file
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);
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
static FILEGEN clockstats;
static FILEGEN rawstats;
static FILEGEN sysstats;
-#ifdef DEBUG
+#ifdef DEBUG_TIMING
static FILEGEN timingstats;
#endif
#ifdef OPENSSL
filegen_register(&statsdir[0], "cryptostats", &cryptostats);
#endif /* OPENSSL */
-#ifdef DEBUG
+#ifdef DEBUG_TIMING
filegen_register(&statsdir[0], "timingstats", &timingstats);
#endif
}
}
#endif /* OPENSSL */
-#ifdef DEBUG
+#ifdef DEBUG_TIMING
/*
* record_crypto_stats - write crypto statistics to file
*
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 (;;)
{
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;
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);
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) {
* Go around again
*/
}
-# ifdef HAVE_SIGNALED_IO
- unblock_io_and_alarm();
-# endif /* HAVE_SIGNALED_IO */
+ UNBLOCK_IO_AND_ALARM();
return 1;
}