Commit 41d88924 authored by Tristan Gingold's avatar Tristan Gingold

wrtd-logging: slightly improve output.

parent 4d5a46af
......@@ -42,6 +42,7 @@ static void print_logging (struct wrtd_node *wrtd, int n_read)
{
struct wrtd_log_entry log;
int i, count, valid, cpu;
uint64_t ps;
valid = wrtd_in_is_valid(wrtd);
if (!valid) {
......@@ -81,9 +82,19 @@ static void print_logging (struct wrtd_node *wrtd, int n_read)
else
fprintf(stdout, "Identifier %04x:%04x:%04x\n",
log.id.system, log.id.source_port, log.id.trigger);
fprintf(stdout, "Timestamp %"PRIu64"s %"PRIu32"tick %"PRIu32"frac\n",
log.ts.seconds, log.ts.ticks, log.ts.frac);
ps = (uint64_t) log.ts.ticks * 8000 + (uint64_t)log.ts.frac * 8000ULL / 4096ULL;
fprintf(stdout,
"Timestamp %"PRIu64"s %"PRIu32"tick %"PRIu32"frac "
"(%03d,%03d,%03dns + %03dps)\n",
log.ts.seconds, log.ts.ticks, log.ts.frac,
(int)(ps / (1000 * 1000 * 1000ULL)),
(int)(ps / (1000 * 1000ULL)) % 1000,
(int)(ps / 1000ULL) % 1000,
(int)(ps % 1000ULL));
fprintf(stdout, "----\n");
fflush(stdout);
i++;
}
......@@ -95,7 +106,7 @@ static void show_logging_level(struct wrtd_node *dev, int cpu)
char log_level_str[128];
int i, err, max = cpu == WRTD_CPU_FD ? FD_NUM_CHANNELS : TDC_NUM_CHANNELS;
fprintf(stdout, "%s log levels\n",
fprintf(stdout, "%s log levels\n",
cpu == WRTD_CPU_FD ? "Output (FD)" : "Input (TDC)");
for (i = 0; i < max; i++) {
if (cpu == WRTD_CPU_FD)
......
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