Commit c946dca5 authored by Alessandro Rubini's avatar Alessandro Rubini

diag: use new diagnostics for time

This is the result, on a master, with "-d 02":

diag-time-2-eth0: posix_time_get:  1362675879.940187923
diag-time-1-eth0: timeout expired: PP_TO_ANN_INTERVAL
diag-time-2-eth0: posix_time_get:  1362675880.081818439
diag-time-2-eth0: posix_time_get:  1362675880.233227916
diag-time-2-eth0: recv stamp: 1362675880.233227916 (user)
diag-time-2-eth0: posix_time_get:  1362675880.233499803
diag-time-1-eth0: timeout expired: PP_TO_SYNC

(time level 1 reports timeouts and set, level 2 reports get-time too).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 11ee59c0
......@@ -75,17 +75,16 @@ static int posix_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int len,
if (tv) {
t->seconds = tv->tv_sec;
t->nanoseconds = tv->tv_usec * 1000;
if (pp_verbose_time)
pp_printf("%s: %9li.%06li\n", __func__, tv->tv_sec,
tv->tv_usec);
} else {
/*
* get the recording time here, even though it may put a big
* spike in the offset signal sent to the clock servo
*/
PP_VPRINTF("no receive time stamp, getting it in user space\n");
ppi->t_ops->get(ppi, t);
}
/* This is not really hw... */
pp_diag(ppi, time, 2, "recv stamp: %i.%09i (%s)\n",
(int)t->seconds, (int)t->nanoseconds, tv ? "kernel" : "user");
return ret;
}
......
......@@ -23,8 +23,9 @@ static int posix_time_get(struct pp_instance *ppi, TimeInternal *t)
clock_fatal_error("clock_gettime");
t->seconds = tp.tv_sec;
t->nanoseconds = tp.tv_nsec;
if (pp_verbose_time && !(pp_global_flags & PP_FLAG_NOTIMELOG))
pp_printf("%s: %9li.%09li\n", __func__, tp.tv_sec, tp.tv_nsec);
if (!(pp_global_flags & PP_FLAG_NOTIMELOG))
pp_diag(ppi, time, 2, "%s: %9li.%09li\n", __func__,
tp.tv_sec, tp.tv_nsec);
return 0;
}
......@@ -36,8 +37,8 @@ int32_t posix_time_set(struct pp_instance *ppi, TimeInternal *t)
tp.tv_nsec = t->nanoseconds;
if (clock_settime(CLOCK_REALTIME, &tp) < 0)
clock_fatal_error("clock_settime");
if (pp_verbose_time)
pp_printf("%s: %9li.%09li\n", __func__, tp.tv_sec, tp.tv_nsec);
pp_diag(ppi, time, 1, "%s: %9li.%09li\n", __func__,
tp.tv_sec, tp.tv_nsec);
return 0;
}
......@@ -56,8 +57,7 @@ int posix_time_adjust(struct pp_instance *ppi, long offset_ns, long freq_ppm)
t.modes = MOD_FREQUENCY | MOD_OFFSET;
ret = adjtimex(&t);
if (pp_verbose_time)
pp_printf("%s: %li %li\n", __func__, offset_ns, freq_ppm);
pp_diag(ppi, time, 1, "%s: %li %li\n", __func__, offset_ns, freq_ppm);
return ret;
}
......
......@@ -176,7 +176,7 @@ static inline int pp_timeout(struct pp_instance *ppi, int index)
time_after_eq(ppi->t_ops->calc_timeout(ppi, 0),
ppi->timeouts[index]);
if (ret && pp_verbose_time)
if (ret)
pp_timeout_log(ppi, index);
return ret;
}
......
......@@ -14,8 +14,9 @@ static int bare_time_get(struct pp_instance *ppi, TimeInternal *t)
}
t->seconds = tv.tv_sec;
t->nanoseconds = tv.tv_usec * 1000;
if (pp_verbose_time && !(pp_global_flags & PP_FLAG_NOTIMELOG))
pp_printf("%s: %9li.%06li\n", __func__, tv.tv_sec, tv.tv_usec);
if (!(pp_global_flags & PP_FLAG_NOTIMELOG))
pp_diag(ppi, time, 2, "%s: %9li.%06li\n", __func__,
tv.tv_sec, tv.tv_usec);
return 0;
}
......@@ -30,12 +31,13 @@ static int bare_time_set(struct pp_instance *ppi, TimeInternal *t)
PP_PRINTF("settimeofday error");
sys_exit(1);
}
if (pp_verbose_time)
pp_printf("%s: %9li.%06li\n", __func__, tv.tv_sec, tv.tv_usec);
pp_diag(ppi, time, 1, "%s: %9li.%06li\n", __func__, tv.tv_sec,
tv.tv_usec);
return 0;
}
static int bare_time_adjust(struct pp_instance *ppi, long offset_ns, long freq_ppm)
static int bare_time_adjust(struct pp_instance *ppi, long offset_ns,
long freq_ppm)
{
struct bare_timex t;
int ret;
......@@ -50,8 +52,7 @@ static int bare_time_adjust(struct pp_instance *ppi, long offset_ns, long freq_p
t.modes = MOD_FREQUENCY | MOD_OFFSET;
ret = sys_adjtimex(&t);
if (pp_verbose_time)
pp_printf("%s: %li %li\n", __func__, offset_ns, freq_ppm);
pp_diag(ppi, time, 1, "%s: %li %li\n", __func__, offset_ns, freq_ppm);
return ret;
}
......
......@@ -21,7 +21,7 @@ static char *timeout_names[__PP_TO_ARRAY_SIZE] __attribute__((used)) = {
*/
void pp_timeout_log(struct pp_instance *ppi, int index)
{
PP_VPRINTF("timeout expire event: %s\n", timeout_names[index]);
pp_diag(ppi, time, 1, "timeout expired: %s\n", timeout_names[index]);
}
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment