}
}
-#if 0
- LOG(LOGS_INFO, LOGF_Keys, "authentication delay for key %lu: %d useconds", key_id, min_usecs);
-#endif
-
/* Add on a bit extra to allow for copying, conversions etc */
- return min_usecs + (min_usecs >> 4);
+ min_usecs += min_usecs >> 4;
+
+ DEBUG_LOG(LOGF_Keys, "authentication delay for key %lu: %ld useconds", key_id, min_usecs);
+
+ return min_usecs;
}
/* ================================================== */
assert(0);
}
-#if 0
- LOG(LOGS_INFO, LOGF_NtpIO, "Initialising, socket fd=%d", sock_fd);
-#endif
-
if (bind(sock_fd, &my_addr.u, my_addr_len) < 0) {
LOG(LOGS_ERR, LOGF_NtpIO, "Could not bind %s NTP socket : %s",
family == AF_INET ? "IPv4" : "IPv6", strerror(errno));
}
#endif
-#if 0
- LOG(LOGS_INFO, LOGF_NtpIO, "sending to %s:%d from %s",
- UTI_IPToString(&remote_addr->ip_addr), remote_addr->port, UTI_IPToString(&remote_addr->local_ip_addr));
-#endif
+ DEBUG_LOG(LOGF_NtpIO, "Sending to %s:%d from %s fd %d",
+ UTI_IPToString(&remote_addr->ip_addr), remote_addr->port,
+ UTI_IPToString(&local_addr->ip_addr), local_addr->sock_fd);
msg.msg_controllen = cmsglen;
/* This is apparently required on some systems */
assert(initialised);
-#if 0
- LOG(LOGS_INFO, LOGF_NtpSources, "IP=%s port=%d", UTI_IPToString(&remote_addr->ip_addr), remote_addr->port);
-#endif
-
/* Find empty bin & check that we don't have the address already */
find_slot(remote_addr, &slot, &found);
if (found) {
assert(initialised);
-#if 0
- LOG(LOGS_INFO, LOGF_NtpSources, "from (%s,%d) at %s",
- UTI_IPToString(&remote_addr->ip_addr),
- remote_addr->port, UTI_TimevalToString(now));
-#endif
-
find_slot(remote_addr, &slot, &found);
if (found == 2) { /* Must match IP address AND port number */
NCR_ProcessKnown(message, now, now_err, records[slot].data,
for (i=0; i<N_RECORDS; i++) {
if (records[i].remote_addr) {
-#if 0
- LOG(LOGS_INFO, LOGF_Sources, "IP=%s dfreq=%f doff=%f",
- UTI_IPToString(&records[i].remote_addr->ip_addr), dfreq, doffset);
-#endif
-
if (change_type == LCL_ChangeUnknownStep) {
NCR_ResetInstance(records[i].data);
} else {
}
}
}
-
}
/* ================================================== */
filter_slew_samples(struct MedianFilter *filter, struct timeval *when, double dfreq, double doffset)
{
int i;
- double delta_time, prev_offset;
+ double delta_time;
struct timeval *sample;
for (i = 0; i < filter->used; i++) {
sample = &filter->samples[i].sample_time;
UTI_AdjustTimeval(sample, when, sample, &delta_time, dfreq, doffset);
- prev_offset = filter->samples[i].offset;
filter->samples[i].offset -= delta_time;
-#if 0
- LOG(LOGS_INFO, LOGF_Refclock, "i=%d old_off=%.9f new_off=%.9f",
- i, prev_offset, filter->samples[i].offset);
-#else
- (void)prev_offset;
-#endif
}
}
(freq_ppm - fb_drifts[i].freq);
}
-#if 0
- LOG(LOGS_INFO, LOGF_Reference, "Fallback drift %d updated: %f ppm %f seconds",
+ DEBUG_LOG(LOGF_Reference, "Fallback drift %d updated: %f ppm %f seconds",
i + fb_drift_min, fb_drifts[i].freq, fb_drifts[i].secs);
-#endif
}
}
if (c > next_fb_drift) {
LCL_SetAbsoluteFrequency(fb_drifts[c - fb_drift_min].freq);
next_fb_drift = c;
-#if 0
- LOG(LOGS_INFO, LOGF_Reference, "Fallback drift %d set", c);
-#endif
+ DEBUG_LOG(LOGF_Reference, "Fallback drift %d set", c);
}
if (i <= fb_drift_max) {
next_fb_drift = i;
UTI_AddDoubleToTimeval(now, secs - unsynchronised, &when);
fb_drift_timeout_id = SCH_AddTimeout(&when, fb_drift_timeout, NULL);
-#if 0
- LOG(LOGS_INFO, LOGF_Reference, "Fallback drift %d scheduled", i);
-#endif
+ DEBUG_LOG(LOGF_Reference, "Fallback drift %d scheduled", i);
}
}
REF_ModifyMaxupdateskew(double new_max_update_skew)
{
max_update_skew = new_max_update_skew * 1.0e-6;
-#if 0
- LOG(LOGS_INFO, LOGF_Reference, "New max update skew = %.3fppm", new_max_update_skew);
-#endif
}
/* ================================================== */
b = X / V;
a = my - b*mx;
-
-#if 0
- printf("my=%20.12f mx=%20.12f a=%20.12f b=%20.12f\n", my, mx, a, b);
-#endif
-
s2 = 0.0;
for (i=start; i<n; i++) {
resid = y[i] - a - b * x[i];
&(si->variance),
&(si->select_ok));
-#if 0
- LOG(LOGS_INFO, LOGF_Sources, "%s dist=%f lo=%f hi=%f",
- source_to_string(sources[i]),
- si->root_distance,
- si->lo_limit, si->hi_limit);
-#endif
-
if (si->select_ok) {
++n_sel_sources;
}
}
-#if 0
- LOG(LOGS_INFO, LOGF_Sources, "badstat_sources=%d sel_sources=%d badstat_reach=%x sel_reach=%x",
+ DEBUG_LOG(LOGF_Sources, "badstat_sources=%d sel_sources=%d badstat_reach=%x sel_reach=%x",
n_badstats_sources, n_sel_sources, max_badstat_reach, max_sel_reach);
-#endif
/* Wait for the next call if we have no source selected and there is
a source with bad stats (has less than 3 samples) with reachability
return;
}
-#if 0
- LOG(LOGS_INFO, LOGF_Sources, "n_endpoints=%d", n_endpoints);
-#endif
-
/* Now sort the endpoint list */
if (n_endpoints > 0) {
best_lo = best_hi = 0.0;
for (i=0; i<n_endpoints; i++) {
-#if 0
- LOG(LOGS_INFO, LOGF_Sources, "i=%d t=%f tag=%d addr=%s", i, sort_list[i].offset, sort_list[i].tag,
- source_to_string(sources[sort_list[i].index]));
-#endif
switch(sort_list[i].tag) {
case LOW:
depth++;
}
}
-#if 0
- LOG(LOGS_INFO, LOGF_Sources, "best_depth=%d best_lo=%f best_hi=%f",
- best_depth, best_lo, best_hi);
-#endif
-
if (best_depth <= n_sel_sources/2) {
/* Could not even get half the reachable sources to agree -
clearly we can't synchronise.
(sources[i]->sel_info.hi_limit <= best_hi))) {
sel_sources[n_sel_sources++] = i;
-#if 0
- LOG(LOGS_INFO, LOGF_Sources, "i=%d addr=%s is valid", i, source_to_string(sources[i]));
-#endif
} else {
sources[i]->status = SRC_FALSETICKER;
-#if 0
- LOG(LOGS_INFO, LOGF_Sources, "i=%d addr=%s is a falseticker", i, source_to_string(sources[i]));
-#endif
}
}
}
}
}
-#if 0
- LOG(LOGS_INFO, LOGF_Sources, "min_distance=%f", min_distance);
-#endif
-
/* Now go through and prune any NTP sources that have excessive
variance */
for (i=0; i<n_sel_sources; i++) {
sqrt(sources[index]->sel_info.variance) > min_distance) {
sel_sources[i] = INVALID_SOURCE;
sources[index]->status = SRC_JITTERY;
-#if 0
- LOG(LOGS_INFO, LOGF_Sources, "i=%d addr=%s has too much variance", i, source_to_string(sources[i]));
-#endif
}
}
#endif
if (stratum < min_stratum) min_stratum = stratum;
}
-#if 0
- LOG(LOGS_INFO, LOGF_Sources, "min_stratum=%d", min_stratum);
-#endif
-
/* Update scores and find source with maximum score */
max_score_index = INVALID_SOURCE;
sources[i]->sel_score = 1.0 / distance;
}
-#if 0
- LOG(LOGS_INFO, LOGF_Sources, "select score=%f refid=%x match_refid=%x status=%d dist=%f",
+ DEBUG_LOG(LOGF_Sources, "select score=%f refid=%x match_refid=%x status=%d dist=%f",
sources[i]->sel_score, sources[i]->ref_id, updated_inst ? updated_inst->ref_id : 0,
sources[i]->status, distance);
-#endif
if (max_score < sources[i]->sel_score) {
max_score = sources[i]->sel_score;
log_selection_message("Selected source %s",
source_to_string(sources[selected_source_index]));
-#if 0
- LOG(LOGS_INFO, LOGF_Sources, "new_sel_index=%d", selected_source_index);
-#endif
-
/* New source has been selected, reset all scores */
for (i=0; i < n_sources; i++) {
sources[i]->sel_score = 1.0;
assert(best_index >= 0);
inst->best_single_sample = best_index;
-
-#if 0
- LOG(LOGS_INFO, LOGF_SourceStats, "n=%d best_index=%d", n, best_index);
-#endif
}
/* ================================================== */
times_back_start = inst->runs_samples + best_start;
prune_register(inst, best_start);
} else {
-#if 0
- LOG(LOGS_INFO, LOGF_SourceStats, "too few points (%d) for regression", inst->n_samples);
-#endif
inst->estimated_frequency = 0.0;
inst->skew = WORST_CASE_FREQ_BOUND;
times_back_start = 0;
if (fabs(offset) - delay_increase > allowed_increase)
return 1;
-#if 0
- LOG(LOGS_INFO, LOGF_SourceStats, "bad sample: offset=%f delay=%f incr_delay=%f allowed=%f", offset, delay, allowed_increase, delay_increase);
-#endif
+ DEBUG_LOG(LOGF_SourceStats, "Bad sample: offset=%f delay=%f incr_delay=%f allowed=%f",
+ offset, delay, allowed_increase, delay_increase);
return 0;
}
if (!shift_hz) {
LOG_FATAL(LOGF_SysLinux, "Can't determine hz (txc.tick=%ld txc.freq=%ld (%.8f) txc.offset=%ld)",
tmx_params.tick, tmx_params.freq, tmx_params.dfreq, tmx_params.offset);
- } else {
-#if 0
- LOG(LOGS_INFO, LOGF_SysLinux, "Initial txc.tick=%ld txc.freq=%ld (%.8f) txc.offset=%ld => hz=%d shift_hz=%d",
- tmx_params.tick, tmx_params.freq, tmx_params.dfreq, tmx_params.offset, hz, shift_hz);
-#endif
}
}
cap_free(cap);
-#if 0
- LOG(LOGS_INFO, LOGF_SysLinux, "Privileges dropped to user %s", user);
-#endif
+ DEBUG_LOG(LOGF_SysLinux, "Privileges dropped to user %s", user);
}
#endif
LOG(LOGS_ERR, LOGF_SysLinux, "sched_setscheduler() failed");
}
else {
-#if 0
- LOG(LOGS_INFO, LOGF_SysLinux, "Enabled SCHED_FIFO with priority %d", sched.sched_priority);
-#endif
+ DEBUG_LOG(LOGF_SysLinux, "Enabled SCHED_FIFO with priority %d",
+ sched.sched_priority);
}
}
}
LOG(LOGS_ERR, LOGF_SysLinux, "mlockall() failed");
}
else {
-#if 0
- LOG(LOGS_INFO, LOGF_SysLinux, "Successfully locked into RAM");
-#endif
+ DEBUG_LOG(LOGF_SysLinux, "Successfully locked into RAM");
}
}
}
kvm_close(kt);
assert(read_back == on_off);
-
-#if 0
- LOG(LOGS_INFO, LOGF_SysSolaris, "Set value of dosynctodr to %d", on_off);
-#endif
-
}
/* ================================================== */
}
kvm_close(kt);
-
-#if 0
- LOG(LOGS_INFO, LOGF_SysSunOS, "Set value of _dosynctodr to %d", on_off);
-#endif
-
}
/* ================================================== */
be backwards, or something wierd has happened. Maybe when we
change the frequency on Linux? */
- /* This seems to be fairly benign, so don't bother logging it */
-
-#if 0
- LOG(LOGS_INFO, LOGF_Util, "Earlier=[%s] Later=[%s]",
- UTI_TimevalToString(earlier), UTI_TimevalToString(later));
-#endif
-
/* Assume the required behaviour is to treat it as zero */
*diff = 0.0;
}