[FFmpeg-devel,3/3] lavu/timer.h: add Linux Perf API support

Submitted by Clément Bœsch on Sept. 7, 2017, 1:59 p.m.

Details

Message ID 20170907135928.GH21898@golem.pkh.me
State New
Headers show

Commit Message

Clément Bœsch Sept. 7, 2017, 1:59 p.m.
On Sun, Sep 03, 2017 at 08:30:24PM +0200, Michael Niedermayer wrote:
> On Sat, Sep 02, 2017 at 08:17:40PM +0200, Clément Bœsch wrote:
> > From: Clément Bœsch <cboesch@gopro.com>
> > 
> > Refer to "checkasm: use perf API on Linux ARM*" commit for the
> > rationale.
> > 
> > The implementation is somehow duplicated with checkasm, but so is the
> > current usage of AV_READ_TIME(). Until these implementations and
> > heuristics are made consistent, I don't see a way of sharing that code.
> > 
> > Note: when using libavutil/timer.h, it is now important to include
> > before any other include due to the _GNU_SOURCE requirement.
> > ---
> >  libavutil/timer.h | 46 +++++++++++++++++++++++++++++++++++++++++++---
> >  1 file changed, 43 insertions(+), 3 deletions(-)
> 
> this breaks building   testprogs on qemu arm:
> 
> src/libavutil/tests/base64.c: In function ‘main’:
> src/libavutil/tests/base64.c:105:159: error: implicit declaration of function ‘syscall’ [-Werror=implicit-function-declaration]
> cc1: some warnings being treated as errors
> make: *** [libavutil/tests/base64.o] Error 1
> make: *** Waiting for unfinished jobs....
> src/libavutil/tests/adler32.c: In function ‘main’:
> src/libavutil/tests/adler32.c:42:159: error: implicit declaration of function ‘syscall’ [-Werror=implicit-function-declaration]
> cc1: some warnings being treated as errors
> make: *** [libavutil/tests/adler32.o] Error 1
> src/libavutil/tests/aes.c: In function ‘main’:
> src/libavutil/tests/aes.c:94:163: error: implicit declaration of function ‘syscall’ [-Werror=implicit-function-declaration]
> cc1: some warnings being treated as errors
> make: *** [libavutil/tests/aes.o] Error 1
> src/libavformat/utils.c: In function ‘avformat_transfer_internal_stream_timing_info’:
> src/libavformat/utils.c:5537:5: warning: ‘codec’ is deprecated (declared at src/libavformat/avformat.h:893) [-Wdeprecated-declarations]
> src/libavformat/utils.c:5538:5: warning: ‘codec’ is deprecated (declared at src/libavformat/avformat.h:893) [-Wdeprecated-declarations]
> 

Fixed in my branch (https://github.com/ubitux/FFmpeg/compare/perf)

Also attaching to this mail the two patches fixing this.

Thanks.

Patch hide | download patch | download mbox

From c5173492fecd1badafdd959987e996f5ca5d64c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <cboesch@gopro.com>
Date: Thu, 7 Sep 2017 15:52:47 +0200
Subject: [PATCH 4/5] lavu/tests: move timer.h include earlier

In the next commit, timer.h will require a _GNU_SOURCE to be set before
including system headers. This commit prevents compilation failures.
---
 libavutil/tests/adler32.c   | 4 +++-
 libavutil/tests/aes.c       | 3 +++
 libavutil/tests/base64.c    | 4 +++-
 libavutil/tests/des.c       | 2 ++
 libavutil/tests/eval.c      | 3 ++-
 libavutil/tests/softfloat.c | 2 ++
 6 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/libavutil/tests/adler32.c b/libavutil/tests/adler32.c
index 511bf1e401..13f760b477 100644
--- a/libavutil/tests/adler32.c
+++ b/libavutil/tests/adler32.c
@@ -17,10 +17,12 @@ 
  */
 
 // LCOV_EXCL_START
+
+#include "libavutil/timer.h"
+
 #include <string.h>
 
 #include "libavutil/log.h"
-#include "libavutil/timer.h"
 #include "libavutil/adler32.h"
 
 #define LEN 7001
diff --git a/libavutil/tests/aes.c b/libavutil/tests/aes.c
index 1291ad6633..c7f842c1c7 100644
--- a/libavutil/tests/aes.c
+++ b/libavutil/tests/aes.c
@@ -17,6 +17,9 @@ 
  */
 
 // LCOV_EXCL_START
+
+#include "libavutil/timer.h"
+
 #include <string.h>
 
 #include "libavutil/aes.h"
diff --git a/libavutil/tests/base64.c b/libavutil/tests/base64.c
index 88fd55c220..400e01cefe 100644
--- a/libavutil/tests/base64.c
+++ b/libavutil/tests/base64.c
@@ -17,12 +17,14 @@ 
  */
 
 // LCOV_EXCL_START
+
+#include "libavutil/timer.h"
+
 #include <stdint.h>
 #include <stdio.h>
 
 #include "libavutil/common.h"
 #include "libavutil/base64.h"
-#include "libavutil/timer.h"
 
 #define MAX_DATA_SIZE    1024
 #define MAX_ENCODED_SIZE 2048
diff --git a/libavutil/tests/des.c b/libavutil/tests/des.c
index eac33d47d4..f2a5c34f1a 100644
--- a/libavutil/tests/des.c
+++ b/libavutil/tests/des.c
@@ -16,6 +16,8 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/timer.h"
+
 #include "libavutil/des.c"
 
 #include <stdint.h>
diff --git a/libavutil/tests/eval.c b/libavutil/tests/eval.c
index 2a1afcc4dc..b64c6d635d 100644
--- a/libavutil/tests/eval.c
+++ b/libavutil/tests/eval.c
@@ -16,12 +16,13 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/timer.h"
+
 #include <math.h>
 #include <stdio.h>
 #include <string.h>
 
 #include "libavutil/libm.h"
-#include "libavutil/timer.h"
 #include "libavutil/eval.h"
 
 static const double const_values[] = {
diff --git a/libavutil/tests/softfloat.c b/libavutil/tests/softfloat.c
index 16788d4da9..c06de44933 100644
--- a/libavutil/tests/softfloat.c
+++ b/libavutil/tests/softfloat.c
@@ -18,6 +18,8 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/timer.h"
+
 #include <inttypes.h>
 
 #include "libavutil/softfloat.h"
-- 
2.14.1