All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] v4l2-ctl: print delta to current clock in verbose mode
@ 2021-01-26 14:24 Max Schulze
  2021-01-27  9:02 ` Hans Verkuil
  0 siblings, 1 reply; 5+ messages in thread
From: Max Schulze @ 2021-01-26 14:24 UTC (permalink / raw)
  To: linux-media

If the Buffer Timestamp Clock is _MONOTONIC, print the delta
to the current clock time. Useful for debugging / insights.


Signed-off-by: Max Schuze <max.schulze@posteo.de>
---
  utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp 
b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index a3580595..d024f925 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -556,9 +556,15 @@ static void print_concise_buffer(FILE *f, 
cv4l_buffer &buf, cv4l_fmt &fmt,
          double ts = buf.g_timestamp().tv_sec + 
buf.g_timestamp().tv_usec / 1000000.0;
          fprintf(f, " ts: %.06f", ts);
          if (last_ts <= 0.0)
-            fprintf(f, " delta: %.03f ms", (ts - last_ts) * 1000.0);
+            fprintf(f, " delta last: %.03f ms", (ts - last_ts) * 1000.0);
          last_ts = ts;

+        if ((buf.g_flags() & V4L2_BUF_FLAG_TIMESTAMP_MASK) == 
V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) {
+            timespec ts_clock;
+            clock_gettime(CLOCK_MONOTONIC, &ts_clock);
+            fprintf(f, " delta now: %+.03f ms", ((ts_clock.tv_sec + 
ts_clock.tv_nsec / 1000000000.0) - ts) * 1000.0);
+        }
+
          if (fps_ts.has_fps(true))
              fprintf(stderr, " fps: %.02f", fps_ts.fps());

-- 
2.29.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-27 11:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26 14:24 [PATCH] v4l2-ctl: print delta to current clock in verbose mode Max Schulze
2021-01-27  9:02 ` Hans Verkuil
2021-01-27  9:19   ` Max Schulze
2021-01-27 10:15     ` Hans Verkuil
2021-01-27 11:00       ` [PATCH v2] " Max Schulze

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.