Implemented general PTP sync algorithm
PATCH 1/1 Implemented general PTP sync algorithm
POC generic PTP time sync algorithm implementation.
Signed-off-by Tzvetomir Stoyanov <[email protected]>
--- tracecmd/trace-msg.c | 8 +- tracecmd/trace-record.c | 2 + tracecmd/trace-timesync.c | 175 ++++++++++++++++++++++++++++++-------- 3 files changed, 144 insertions(+), 41 deletions(-)
tracecmd/trace-msg.c +4 -4
@@ -55,7 +55,7 @@ static inline void dprint(const char *fmt, ...)unsigned int page_size;/* Try a few times to get an accurate time sync */ -#define TSYNC_TRIES 300 +#define TSYNC_TRIES 2000struct tracecmd_msg_tinit {be32 cpus;
@@ -1043,14 +1043,14 @@ int tracecmd_msg_snd_time_sync(struct tracecmd_msg_handle *msg_handle, }tracecmd_clock_synch_calc_probe (clock_context, event.ts, -htonll (msg.ts_resp.time)); +ntohll (msg.ts_resp.time)); }while (--sync_loop);tracecmd_clock_synch_disable (clock_context);tracecmd_clock_synch_calc (clock_context, offset, timestamp);tracecmd_msg_init (MSG_TSYNC_STOP , &msg); - msg.ts_stop.offset =htonll (*offset); - msg.ts_stop.timestamp =htonll (*timestamp); + msg.ts_stop.offset =ntohll (*offset); + msg.ts_stop.timestamp =ntohll (*timestamp);tracecmd_msg_send (msg_handle->fd, &msg);msg_free (&msg);
tracecmd/trace-record.c +2 -0
@@ -5770,6 +5770,8 @@ static bool has_local_instances(void)return false; } +#define TSYNC_DEBUG +static void write_guest_time_shift (struct buffer_instance *instance) {struct tracecmd_output *handle;
tracecmd/trace-timesync.c +138 -37
269 lines not on this page · raw message
Signature · 1 line
2.21.0