From 862ab2a30e2c29a91acde93da1e8c687e9c41ce4 Mon Sep 17 00:00:00 2001 From: Tonton Th Date: Tue, 28 May 2019 12:10:55 +0200 Subject: [PATCH] ajout d'un chronometre --- .gitignore | 2 +- v4l2/Makefile | 2 +- v4l2/grabvidseq.c | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ac00857..c3133b6 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ essai v4l2/t v4l2/capture -v4l2/v4l2grab +v4l2/grabvidseq v4l2/*.o v4l2/*.ppm diff --git a/v4l2/Makefile b/v4l2/Makefile index f18d3cf..183a764 100644 --- a/v4l2/Makefile +++ b/v4l2/Makefile @@ -16,6 +16,6 @@ capture: capture.c Makefile gcc -Wall -g $< -o $@ grabvidseq: grabvidseq.c Makefile - gcc -Wall -g $< -lv4l2 -o $@ + gcc -Wall -g $< ../libfloatimg.a -lv4l2 -o $@ diff --git a/v4l2/grabvidseq.c b/v4l2/grabvidseq.c index a920e95..88af9e9 100644 --- a/v4l2/grabvidseq.c +++ b/v4l2/grabvidseq.c @@ -26,6 +26,8 @@ #include #include +#include "../floatimg.h" + #define CLEAR(x) memset(&(x), 0, sizeof(x)) struct buffer { @@ -80,6 +82,7 @@ struct buffer *buffers; int period = 10; /* delai entre les captures */ int nbre_capt = 1; /* nombre de captures */ int opt; +double t_debut, t_final; while ((opt = getopt(argc, argv, "d:hn:p:v")) != -1) { switch(opt) { @@ -142,6 +145,7 @@ for (n_buffers = 0; n_buffers < req.count; ++n_buffers) { } } +t_debut = fimg_timer_set(0); for (i = 0; i < n_buffers; ++i) { CLEAR(buf); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; @@ -194,6 +198,9 @@ for (i = 0; i < nbre_capt; i++) { xioctl(fd, VIDIOC_QBUF, &buf); } +t_final = fimg_timer_get(0); +fprintf(stderr, "elapsed time %g s.\n", t_final); + type = V4L2_BUF_TYPE_VIDEO_CAPTURE; xioctl(fd, VIDIOC_STREAMOFF, &type); for (i = 0; i < n_buffers; ++i) {