diff --git a/monitor/monitor_ppsi.c b/monitor/monitor_ppsi.c index 523f0a23cb85cf8ca87406a704b680c7861c05d6..950c1df0f5062118daef94b677e5c0878ea84abc 100644 --- a/monitor/monitor_ppsi.c +++ b/monitor/monitor_ppsi.c @@ -266,9 +266,11 @@ static void wrc_mon_std_servo(void) } +/* internal "last", exported to shell command */ +uint32_t wrc_stats_last; + int wrc_log_stats(void) { - static uint32_t last = ~0; /* if we are master, update count is 0 */ struct hal_port_state state; int tx, rx; int aux_stat; @@ -277,9 +279,9 @@ int wrc_log_stats(void) struct wr_servo_state *s = &((struct wr_data *)ppi->ext_data)->servo_state; - if (last == s->update_count) + if (wrc_stats_last == s->update_count) return 0; - last = s->update_count; + wrc_stats_last = s->update_count; shw_pps_gen_get_time(&sec, &nsec); wrpc_get_port_state(&state, NULL); diff --git a/shell/cmd_stat.c b/shell/cmd_stat.c index e44ff750651f5a53d4c27489d18a595150eb51b4..7e158e6fdcbe54fac6b91b6f17dcb8fb02d9b497 100644 --- a/shell/cmd_stat.c +++ b/shell/cmd_stat.c @@ -5,23 +5,26 @@ #include <errno.h> int wrc_stat_running; +extern uint32_t wrc_stats_last; static int cmd_stat(const char *args[]) { /* no arguments: invert */ if (!args[0]) { wrc_stat_running = !wrc_stat_running; + wrc_stats_last--; /* force a line to be printed */ if (!wrc_stat_running) pp_printf("statistics now off\n"); return 0; } /* arguments: bts, on, off */ - if (!strcasecmp(args[0], "bts")) + if (!strcasecmp(args[0], "bts")) { mprintf("%d ps\n", ep_get_bitslide()); - else if (!strcasecmp(args[0], "on")) + } else if (!strcasecmp(args[0], "on")) { wrc_stat_running = 1; - else if (!strcasecmp(args[0], "off")) { + wrc_stats_last--; /* force a line to be printed */ + } else if (!strcasecmp(args[0], "off")) { wrc_stat_running = 0; pp_printf("statistics now off\n"); } else