* [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
* Re: [PATCH] v4l2-ctl: print delta to current clock in verbose mode 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 0 siblings, 1 reply; 5+ messages in thread From: Hans Verkuil @ 2021-01-27 9:02 UTC (permalink / raw) To: Max Schulze, linux-media Hi Max, On 26/01/2021 15:24, Max Schulze wrote: > 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); I have no objection to this, but I think this needs to be enabled with a new option (e.g. --stream-show-delta-now) to avoid cluttering the output too much. Regards, Hans > + } > + > if (fps_ts.has_fps(true)) > fprintf(stderr, " fps: %.02f", fps_ts.fps()); > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] v4l2-ctl: print delta to current clock in verbose mode 2021-01-27 9:02 ` Hans Verkuil @ 2021-01-27 9:19 ` Max Schulze 2021-01-27 10:15 ` Hans Verkuil 0 siblings, 1 reply; 5+ messages in thread From: Max Schulze @ 2021-01-27 9:19 UTC (permalink / raw) To: Hans Verkuil, linux-media Hello Hans, On 27.01.21 10:02, Hans Verkuil wrote: > Hi Max, > > On 26/01/2021 15:24, Max Schulze wrote: >> 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); > I have no objection to this, but I think this needs to be enabled > with a new option (e.g. --stream-show-delta-now) to avoid cluttering > the output too much. > Note we already need to be in verbose mode and not skip_ts . Example output: > cap dqbuf: 0 seq: 0 bytesused: 512000 ts: 137342.420951 delta > last: 137342420.951 ms delta now: +56.301 ms (ts-monotonic, ts-src-soe) > cap dqbuf: 1 seq: 2 bytesused: 512000 ts: 137342.484954 delta > now: +28.171 ms dropped: 1 (ts-monotonic, ts-src-soe) > cap dqbuf: 2 seq: 3 bytesused: 512000 ts: 137342.520953 delta > now: +24.296 ms (ts-monotonic, ts-src-soe) > cap dqbuf: 3 seq: 4 bytesused: 512000 ts: 137342.556925 delta > now: +24.269 ms (ts-monotonic, ts-src-soe) > cap dqbuf: 0 seq: 5 bytesused: 512000 ts: 137342.592909 delta > now: +24.216 ms fps: 29.08 (ts-monotonic, ts-src-soe) BTW: is this the supposed way to display the "delta last", [...] "show the timestamp delta between two successive frames." ? Do you want me to make another patch with mentioned command line option? Best, Max ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] v4l2-ctl: print delta to current clock in verbose mode 2021-01-27 9:19 ` Max Schulze @ 2021-01-27 10:15 ` Hans Verkuil 2021-01-27 11:00 ` [PATCH v2] " Max Schulze 0 siblings, 1 reply; 5+ messages in thread From: Hans Verkuil @ 2021-01-27 10:15 UTC (permalink / raw) To: Max Schulze, linux-media On 27/01/2021 10:19, Max Schulze wrote: > Hello Hans, > > On 27.01.21 10:02, Hans Verkuil wrote: >> Hi Max, >> >> On 26/01/2021 15:24, Max Schulze wrote: >>> 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); >> I have no objection to this, but I think this needs to be enabled >> with a new option (e.g. --stream-show-delta-now) to avoid cluttering >> the output too much. >> > Note we already need to be in verbose mode and not skip_ts . > > Example output: > >> cap dqbuf: 0 seq: 0 bytesused: 512000 ts: 137342.420951 delta >> last: 137342420.951 ms delta now: +56.301 ms (ts-monotonic, ts-src-soe) >> cap dqbuf: 1 seq: 2 bytesused: 512000 ts: 137342.484954 delta >> now: +28.171 ms dropped: 1 (ts-monotonic, ts-src-soe) >> cap dqbuf: 2 seq: 3 bytesused: 512000 ts: 137342.520953 delta >> now: +24.296 ms (ts-monotonic, ts-src-soe) >> cap dqbuf: 3 seq: 4 bytesused: 512000 ts: 137342.556925 delta >> now: +24.269 ms (ts-monotonic, ts-src-soe) >> cap dqbuf: 0 seq: 5 bytesused: 512000 ts: 137342.592909 delta >> now: +24.216 ms fps: 29.08 (ts-monotonic, ts-src-soe) > BTW: is this the supposed way to display the "delta last", [...] "show > the timestamp delta between two successive frames." ? Yes. > > > Do you want me to make another patch with mentioned command line option? Yes please! Regards, Hans > > > Best, > > Max > ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] v4l2-ctl: print delta to current clock in verbose mode 2021-01-27 10:15 ` Hans Verkuil @ 2021-01-27 11:00 ` Max Schulze 0 siblings, 0 replies; 5+ messages in thread From: Max Schulze @ 2021-01-27 11:00 UTC (permalink / raw) To: Hans Verkuil, linux-media If the Buffer Timestamp Clock is _MONOTONIC, print the delta to the current clock time needs --stream-show-delta-now together with --verbose Signed-off-by: Max Schuze <max.schulze@posteo.de> --- Changes since v1: * Hide behind command-line Option utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 12 +++++++++++- utils/v4l2-ctl/v4l2-ctl.cpp | 1 + utils/v4l2-ctl/v4l2-ctl.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index a3580595..df465561 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -326,6 +326,10 @@ void streaming_usage() " --stream-out-dmabuf\n" " output video using dmabuf [VIDIOC_(D)QBUF]\n" " Requires a corresponding --stream-mmap option.\n" + " --stream-show-delta-now\n" + " output the difference between the buffer timestamp and current\n" + " clock, if the buffer timestamp source is the monotonic clock.\n" + " requires --verbose\n" " --list-patterns list available patterns for use with --stream-pattern.\n" " --list-buffers list all video buffers [VIDIOC_QUERYBUF]\n" " --list-buffers-out list all video output buffers [VIDIOC_QUERYBUF]\n" @@ -556,9 +560,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 (options[OptStreamShowDeltaNow] && (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()); diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp index 6da4698a..4e179f77 100644 --- a/utils/v4l2-ctl/v4l2-ctl.cpp +++ b/utils/v4l2-ctl/v4l2-ctl.cpp @@ -265,6 +265,7 @@ static struct option long_options[] = { {"stream-out-mmap", optional_argument, nullptr, OptStreamOutMmap}, {"stream-out-user", optional_argument, nullptr, OptStreamOutUser}, {"stream-out-dmabuf", no_argument, nullptr, OptStreamOutDmaBuf}, + {"stream-show-delta-now", no_argument, nullptr, OptStreamShowDeltaNow}, {"list-patterns", no_argument, nullptr, OptListPatterns}, {"version", no_argument, nullptr, OptVersion}, {nullptr, 0, nullptr, 0} diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h index a4f193cc..909b96e4 100644 --- a/utils/v4l2-ctl/v4l2-ctl.h +++ b/utils/v4l2-ctl/v4l2-ctl.h @@ -245,6 +245,7 @@ enum Option { OptStreamOutMmap, OptStreamOutUser, OptStreamOutDmaBuf, + OptStreamShowDeltaNow, OptListPatterns, OptHelpTuner, OptHelpIO, -- 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.