[Git][NTPsec/ntpsec][master] Allow ENABLE_DEBUG_TIMING to be set at waf configuration time.

Eric S. Raymond gitlab at mg.gitlab.com
Wed Aug 24 04:45:35 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
ba2737f1 by Eric S. Raymond at 2016-08-24T00:44:45-04:00
Allow ENABLE_DEBUG_TIMING to be set at waf configuration time.

- - - - -


6 changed files:

- devel/ifdex-ignores
- ntpd/ntp_io.c
- ntpd/ntp_util.c
- ntpd/ntpd.c
- wafhelpers/configure.py
- wafhelpers/options.py


Changes:

=====================================
devel/ifdex-ignores
=====================================
--- a/devel/ifdex-ignores
+++ b/devel/ifdex-ignores
@@ -41,7 +41,6 @@ NTPD_PRIO		# Priority to set the daemon to
 
 # Fine-grained debugging and tracing, not presently settable from waf
 DEBUG
-DEBUG_TIMING		# In the future, might be set by waf
 ISC_LIST_CHECKINIT	# Debugging flag
 ISC_PLATFORM_USEBACKTRACE	# Use the ISC backtrace code on assertions
 ISC_UTIL_TRACEON	# Enables trace code in ISC service routines.
@@ -58,6 +57,7 @@ DEBUG_PPS720		# Only in refclock_true.c
 ISC_PLATFORM_BRACEPTHREADONCEINIT
 
 # Things WAF sets that don't get #undefs if they're not set
+ENABLE_DEBUG_TIMING
 ENABLE_DNS_RETRY
 ENABLE_IPV6
 ENABLE_LOCKCLOCK


=====================================
ntpd/ntp_io.c
=====================================
--- a/ntpd/ntp_io.c
+++ b/ntpd/ntp_io.c
@@ -367,7 +367,7 @@ maintain_activefds(
 #endif	/* !HAVE_IO_COMPLETION_PORT */
 
 
-#ifdef DEBUG_TIMING
+#ifdef ENABLE_DEBUG_TIMING
 /*
  * collect timing information for various processing
  * paths. currently we only pass them on to the file
@@ -3314,11 +3314,11 @@ fetch_timestamp(
 	double			fuzz;
 	l_fp			lfpfuzz;
 	l_fp			nts;
-#ifdef DEBUG_TIMING
+#ifdef ENABLE_DEBUG_TIMING
 	l_fp			dts;
 #endif
 
-#ifndef DEBUG_TIMING
+#ifndef ENABLE_DEBUG_TIMING
 	UNUSED_ARG(rb);
 #endif
 
@@ -3393,14 +3393,14 @@ fetch_timestamp(
 			fuzz = ntp_random() * 2. / FRAC * sys_fuzz;
 			DTOLFP(fuzz, &lfpfuzz);
 			L_ADD(&nts, &lfpfuzz);
-#ifdef DEBUG_TIMING
+#ifdef ENABLE_DEBUG_TIMING
 			dts = ts;
 			L_SUB(&dts, &nts);
 			collect_timing(rb, "input processing delay", 1,
 				       &dts);
 			DPRINTF(4, ("fetch_timestamp: timestamp delta: %s (incl. fuzz)\n",
 				    lfptoa(&dts, 9)));
-#endif	/* DEBUG_TIMING */
+#endif	/* ENABLE_DEBUG_TIMING */
 			ts = nts;  /* network time stamp */
 			break;
 #endif	/* USE_SCM_BINTIME || USE_SCM_TIMESTAMPNS || USE_SCM_TIMESTAMP */
@@ -3626,7 +3626,7 @@ input_handler(
 	blocking_child *c;
 	struct timeval	tvzero;
 	l_fp		ts;	/* Timestamp at BOselect() gob */
-#ifdef DEBUG_TIMING
+#ifdef ENABLE_DEBUG_TIMING
 	l_fp		ts_e;	/* Timestamp at EOselect() gob */
 #endif
 	fd_set		fds;
@@ -3807,7 +3807,7 @@ input_handler(
 		goto ih_return;
 	}
 	/* We've done our work */
-#ifdef DEBUG_TIMING
+#ifdef ENABLE_DEBUG_TIMING
 	get_systime(&ts_e);
 	/*
 	 * (ts_e - ts) is the amount of time we spent
@@ -3821,7 +3821,7 @@ input_handler(
 		msyslog(LOG_DEBUG,
 			"input_handler: Processed a gob of fd's in %s msec",
 			lfptoms(&ts_e, 6));
-#endif /* DEBUG_TIMING */
+#endif /* ENABLE_DEBUG_TIMING */
 	/* We're done... */
     ih_return:
 	return;


=====================================
ntpd/ntp_util.c
=====================================
--- a/ntpd/ntp_util.c
+++ b/ntpd/ntp_util.c
@@ -711,7 +711,7 @@ record_proto_stats(
 	}
 }
 
-#ifdef DEBUG_TIMING
+#ifdef ENABLE_DEBUG_TIMING
 /*
  * record_timing_stats - write timing statistics to file
  *


=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -992,7 +992,7 @@ static void mainloop(void)
 
 # endif		/* !HAVE_IO_COMPLETION_PORT */
 
-# ifdef DEBUG_TIMING
+# ifdef ENABLE_DEBUG_TIMING
 		{
 			l_fp pts;
 			l_fp tsa, tsb;
@@ -1020,7 +1020,7 @@ static void mainloop(void)
 				 * packet.
 				 */
 				if (rbuf->receiver != NULL) {
-# ifdef DEBUG_TIMING
+# ifdef ENABLE_DEBUG_TIMING
 					l_fp dts = pts;
 
 					L_SUB(&dts, &rbuf->recv_time);
@@ -1038,7 +1038,7 @@ static void mainloop(void)
 				freerecvbuf(rbuf);
 				rbuf = get_full_recv_buffer();
 			}
-# ifdef DEBUG_TIMING
+# ifdef ENABLE_DEBUG_TIMING
 			intercept_get_systime(__func__, &tsb);
 			L_SUB(&tsb, &tsa);
 			if (bufcount) {


=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -524,6 +524,10 @@ def cmd_configure(ctx, config):
         else:
             ctx.undefine("ENABLE_CLASSIC_MODE")
 
+	if ctx.options.enable_debug_timing:
+	    ctx.define("ENABLE_DEBUG_TIMING", 1)
+        else:
+            ctx.undefine("ENABLE_DEBUG_TIMING")
 
 	ctx.start_msg("Writing configuration header:")
 	ctx.write_config_header("config.h")


=====================================
wafhelpers/options.py
=====================================
--- a/wafhelpers/options.py
+++ b/wafhelpers/options.py
@@ -18,6 +18,7 @@ def options_cmd(ctx, config):
 	grp.add_option('--disable-dns-retry', action='store_true', default=False, help="Disable retrying DNS lookups.")
 	grp.add_option('--disable-mdns-registration', action='store_true', default=False, help="Disable MDNS registration.")
 	grp.add_option('--enable-classic-mode', action='store_true', default=False, help="Strict configuration and log-format compatibility with NTP Classic")
+	grp.add_option('--enable-debug-timing', action='store_true', default=False, help="Cillect timing statistics for debugging.")
 	grp.add_option('--disable-lineeditlibs', action='store_true', default=False, help="Disable line editing support")
 
 	grp = ctx.add_option_group("NTP cross compile options")



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/ba2737f11342da2a8c6374dace9d08e15c3150bf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160824/5543d6c2/attachment.html>


More information about the vc mailing list