From 264fe5e0574312fedba8aee9ee3c30d48a9fb0be Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 7 Dec 2022 15:01:39 +0100 Subject: [PATCH] pstats: Fix clock skew handling when frames arrive out-of-order --- pandatool/src/pstatserver/pStatTimeline.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pandatool/src/pstatserver/pStatTimeline.cxx b/pandatool/src/pstatserver/pStatTimeline.cxx index 6ccb603d34..e30ac5bfac 100644 --- a/pandatool/src/pstatserver/pStatTimeline.cxx +++ b/pandatool/src/pstatserver/pStatTimeline.cxx @@ -230,6 +230,18 @@ update_bars(int thread_index, int frame_number) { << format_number(delta, GBU_show_units | GBU_ms) << " in frame " << frame_number << " of thread " << thread_index << "\n"; + + // Move all bars after this frame to the right by this amount. + for (ThreadRow &thread_row : _threads) { + for (Row &row : thread_row._rows) { + for (ColorBar &bar : row) { + if (bar._frame_number > frame_number) { + bar._start += delta; + bar._end += delta; + } + } + } + } } prev = time;