summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8555e6a)
raw | patch | inline | side by side (parent: 8555e6a)
author | Nikhil Devshatwar <nikhil.nd@ti.com> | |
Thu, 25 Sep 2014 09:06:07 +0000 (14:36 +0530) | ||
committer | Nikhil Devshatwar <nikhil.nd@ti.com> | |
Wed, 1 Oct 2014 08:38:31 +0000 (14:08 +0530) |
To profile the driver capture latency and display latency,
Calculate the latencies at QBUF and DQBUF ioctls
Print the latencies only when --debug is passed.
Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Calculate the latencies at QBUF and DQBUF ioctls
Print the latencies only when --debug is passed.
Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
util/v4l2.c | patch | blob | history |
diff --git a/util/v4l2.c b/util/v4l2.c
index f902d50831d594e141e99a3bb3dfa58ed6e48b58..924e14b6966190d7f342bee8dad8e09e2257f549 100644 (file)
--- a/util/v4l2.c
+++ b/util/v4l2.c
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
+#include <pthread.h>
#include "util.h"
struct v4l2_buffer *v4l2buf = NULL;
int i, ret, fd;
+ struct timeval disp_time;
+ struct timeval disp_lat;
+ pthread_t tid;
+
assert(buf->nbo == 1); /* TODO add multi-planar support */
fd = buf->fd[0];
}
}
+ tid = pthread_self();
+ gettimeofday(&disp_time, NULL);
+ timersub(&disp_time, &v4l2buf->timestamp, &disp_lat);
+ if(v4l2buf->timestamp.tv_sec)
+ DBG("%x: DISP latency = %d.%6d", tid, disp_lat.tv_sec, disp_lat.tv_usec);
+
if (!v4l2buf) {
ERROR("invalid buffer");
return -1;
struct buffer *
v4l2_dqbuf(struct v4l2 *v4l2)
{
+ struct timeval dq_time;
+ struct timeval dq_lat;
+ pthread_t tid;
+
struct buffer *buf;
struct v4l2_buffer v4l2buf = {
.type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
}
buf = v4l2->bufs[v4l2buf.index];
+ v4l2->v4l2bufs[v4l2buf.index].timestamp = v4l2buf.timestamp;
assert(buf->nbo == 1); /* TODO add multi-planar support */
+ tid = pthread_self();
+ gettimeofday(&dq_time, NULL);
+ timersub(&dq_time, &v4l2buf.timestamp, &dq_lat);
+ DBG("%x: DQ latency = %d.%6d", tid, dq_lat.tv_sec, dq_lat.tv_usec);
+
return buf;
}