Make the log output a bit more clear by changing how we inform the user
when the local clock is the best master clock. This allows easier
parsing of the log and identifying when the local clock is being
selected as the best clock.

Signed-off-by: Jacob Keller <jacob.e.kel...@intel.com>
---
I've often been looking at log output from ptp4l and wondered which
clock id was which port. This patch helps ease the mental burden by
explicitly stating when we selected the local clock as the best choice.

 clock.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/clock.c b/clock.c
index 199c0cbf54f3..8767e0a6dbba 100644
--- a/clock.c
+++ b/clock.c
@@ -1709,8 +1709,13 @@ static void handle_state_decision_event(struct clock *c)
                best_id = c->dds.clockIdentity;
        }
 
-       pr_notice("selected best master clock %s",
-                 cid2str(&best_id));
+       if (cid_eq(&best_id, &c->dds.clockIdentity)) {
+               pr_notice("selected local clock %s as best master",
+                         cid2str(&best_id));
+       } else {
+               pr_notice("selected best master clock %s",
+                         cid2str(&best_id));
+       }
 
        if (!cid_eq(&best_id, &c->best_id)) {
                clock_freq_est_reset(c);
-- 
2.15.1.478.ga1e07cd25f8b


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to