In the free-running mode the stats are updated only once per the
frequency estimation interval instead of once per sync message. The
stats max_count calculation didn't account for that, which caused a
reduced rate of printed summaries. Fix the calculation for this case.

Signed-off-by: Miroslav Lichvar <mlich...@redhat.com>
---
 clock.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/clock.c b/clock.c
index fe08d48..5a64613 100644
--- a/clock.c
+++ b/clock.c
@@ -2086,7 +2086,12 @@ void clock_sync_interval(struct clock *c, int n)
        }
        c->fest.max_count = (1U << shift);
 
-       shift = c->stats_interval - n;
+       /* In free-running mode stats accumulate once per freq_est_interval */
+       if (c->free_running)
+               shift = c->stats_interval - n - shift;
+       else
+               shift = c->stats_interval - n;
+
        if (shift < 0)
                shift = 0;
        else if (shift >= sizeof(int) * 8) {
-- 
2.40.1



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to