From patchwork Fri Jul 14 18:28:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 42681 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp3863304pzb; Fri, 14 Jul 2023 11:28:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlGHlcykKypoKwFIm6shV1rhQKf9X+yteZg9Q8NGq4ahSzNH4h+9I+4afgO79fOZKiJEtU2d X-Received: by 2002:a17:907:7d9e:b0:988:b204:66b0 with SMTP id oz30-20020a1709077d9e00b00988b20466b0mr4091198ejc.33.1689359324688; Fri, 14 Jul 2023 11:28:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689359324; cv=none; d=google.com; s=arc-20160816; b=X/fSWSiJAP3ZlU55yeWwkHo36T74mkLuCoD/4B4dvLlkgMPtt804vYjBgW7Iw7ZOxM FCPEvAL0T1Xx5+co3gyuNc+g0lscMyg88DocswCFkUVN6ND+A3BuwOWOTkp04SZuN8bk uDlQgDaaWKO86l5hgTsszikr0wiHubIrasusc6LURP40s/fSI/szwmQqqBTX6WQ1EUDD 1UdNnjqTcSLwUQKjrSoROzjR/P5R6uEieOBkrTcT1xRY5oAjr66soVhJwo8hKp+hcxiC Ylxx9QI49Ef9Izjw5E3wAj1TXEM84K1kfBVPoAKV9cMjp2NiVEZy2L59oKD7WIi5p+Pq pqGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=07Hu0etdWbwKl7xhUaXmJAysYnG+hgwJMKS7gSdyJc0=; fh=hQcp50obTJ8bXC1it5NuEN23RGKfx0/zZ3s2gmreL+A=; b=sdXSRwM2qHqOgtElslwyBVIMI46TsxlE1KbAKSyxQQk8m57iCnsaUrhoy/O4YcPsYS 48qIPiM/dlO0SNf2Nh6jxYR02vP1GKqBCSf8OSaoz2mE7HtpJ4A657KvViPMojiR0Y80 jzWKdR8J6oVU/3X6U8CWPiQZd82uZ7MXybYkwoMdo4QFha/U6Mz7G5YlAZX6rzBgOG3F 3mS+0m9S3AR4N5jjfFwAa17Xf5nkG0BqF7Rnqz0ABcqOH3TGN+h1PJg5P49OIDSEBy7V LvOEdmK74qpEET/RzjK0JIitn+Yi+37Qs1PgP6fcPISY+/sqTJcZ2NBPSk9vJKlRM8HE AG6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id o16-20020a17090608d000b00992f1a3b9c0si8971552eje.414.2023.07.14.11.28.44; Fri, 14 Jul 2023 11:28:44 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2D36F68C645; Fri, 14 Jul 2023 21:28:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F185468C4CE for ; Fri, 14 Jul 2023 21:28:35 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 92368C000E for ; Fri, 14 Jul 2023 21:28:35 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 14 Jul 2023 21:28:29 +0300 Message-Id: <20230714182835.66326-1-remi@remlab.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <12243004.O9o76ZdvQC@basile.remlab.net> References: <12243004.O9o76ZdvQC@basile.remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/7] checkasm: fix Linux perf cleanup X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Z+Zq2ISF72g5 0 is a valid file descriptor. --- tests/checkasm/checkasm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 4311a8ffcb..1da0877be5 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -317,7 +317,9 @@ static struct { const char *cpu_flag_name; const char *test_name; int verbose; -} state; +} state = { + .sysfd = -1, +}; /* PRNG state */ AVLFG checkasm_lfg; @@ -710,7 +712,7 @@ static int bench_init(void) static void bench_uninit(void) { #if CONFIG_LINUX_PERF - if (state.sysfd > 0) + if (state.sysfd != -1) close(state.sysfd); #endif } From patchwork Fri Jul 14 18:28:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 42682 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp3863353pzb; Fri, 14 Jul 2023 11:28:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlEws8d/84iclzQuMY26WANrac4Qgn8PP3QbU7CngoYn1f6UqnSr5+uctxjT72pBaWPOB8xB X-Received: by 2002:a2e:8753:0:b0:2b8:3ac9:e201 with SMTP id q19-20020a2e8753000000b002b83ac9e201mr2313790ljj.40.1689359333177; Fri, 14 Jul 2023 11:28:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689359333; cv=none; d=google.com; s=arc-20160816; b=XCayIHEnjueZ7i3L76GCYWGc8wxknLl81cX17F86veK78mZck3Mv1CYyXsJVse8Zzg piGIDQ7JcZ5qmIUKMNWiaiig7i0KtvXBT3Kp+sBe6xIf2YjqoUN01VFV9MWigRJpJLPM Wzb/NS0o6hyLVA8ejCXUurRl2+vuqbWFtz1ROckrNZ0znd2ZwvnZu/GrCixBri21ue8E K7lpQiz6VRbNsreS+PrghYyZA7LoAVC2d1/xMrfyewK+D41zrFX/mx0zS+hKzaVJk/g4 WFN+aQagt/VmTVA0X4ai0DP+82swmPSSjAgFsSg+4yILc4rj9NX6169oLclogtwFsTUM wP+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=GBWbxsozaPJm11AS2v5B26ymqU1sB9g8WKpwiWMjnvQ=; fh=hQcp50obTJ8bXC1it5NuEN23RGKfx0/zZ3s2gmreL+A=; b=Gl1g3hSPxrt5e/shOLwXbRr1enKRzPxiDNEWE+OyXL4kAdhpeX43eDC8vS2I+hg/gH vLP0X/UtBxSQeGPnLV1CcReLfE+yXLTMchhWBifp0MSDImDGvp8T6bkasCTu5HVvSL/B ucJFyEl22BhB6uXEZ+WWRFQ8wTfLyYqjVwSAfQRb/v5W6dl8rTO/D1GWtxFtrhfkF2aP bXoilgvRcB+dJnZ4CGHRlh7DdBS5rzZ4s4YMSYT8uyPCPWTwwsRkJq7gwQMIk+T/vLzm bhrIWBezfT8rg16hfWiTySNZYvmCdtaIp+bEEY4FTF4YPno51YSunDwhniHrAG5ts2yM YovA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i23-20020a1709064ed700b0098cf3eaee47si9289456ejv.689.2023.07.14.11.28.52; Fri, 14 Jul 2023 11:28:53 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2530668C652; Fri, 14 Jul 2023 21:28:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1E27C68C541 for ; Fri, 14 Jul 2023 21:28:36 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id C77AAC00AE for ; Fri, 14 Jul 2023 21:28:35 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 14 Jul 2023 21:28:30 +0300 Message-Id: <20230714182835.66326-2-remi@remlab.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <12243004.O9o76ZdvQC@basile.remlab.net> References: <12243004.O9o76ZdvQC@basile.remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/7] checkasm: improve Linux perf error message X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: dQfQvhFL1Mgs Report the failing system call name, as is convention, rather than just a rather unhelpful "syscall". --- tests/checkasm/checkasm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 1da0877be5..bfc0a48079 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -668,7 +668,7 @@ static int bench_init_linux(void) state.sysfd = syscall(__NR_perf_event_open, &attr, 0, -1, -1, 0); if (state.sysfd == -1) { - perror("syscall"); + perror("perf_event_open"); return -1; } return 0; From patchwork Fri Jul 14 18:28:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 42683 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp3863423pzb; Fri, 14 Jul 2023 11:29:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlF1eI4r9gDmzhSZf3RMQleuTDENrbsI6XkL2RbaXNiZxy7DML/Xr1bQWd0gwjxWhKk9wt5U X-Received: by 2002:aa7:c1d4:0:b0:51e:2492:3202 with SMTP id d20-20020aa7c1d4000000b0051e24923202mr5897431edp.33.1689359341330; Fri, 14 Jul 2023 11:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689359341; cv=none; d=google.com; s=arc-20160816; b=t6o1iWCnv2/mhHuFcbN9jrsLI4d3Wn/uFOx39MwF8LdfY2PqsTEP281eZ84Wbr7M78 WmFmiEf/DP9v09OdoDYmvduktO3Yff2Jt3cQp3QApr3T0folMd4/Gqtjihjxmnw04uIX bL8kQZC10Wc8CtHOpCr1zjfF1bN8yOh9xtezEGtEN1GQHz6I0ikNCrT4sk+gArTFMMas 1+u+NMlwytsB0xdGuTi5u2zIs7iQxES+Esxgf0Er/Qn12XQMTFB5yskhUHOvXp2ggXVm xsqd26L5qrghGhYaD+nhP66po97GGnBihkoedkYoXuEvE1GEaMwtJI1lD1BtbnBuvToY m5Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=3funrLvu9KfuuQ3pEPB/UiBeb22p00s7D/8OJ0mMtpo=; fh=hQcp50obTJ8bXC1it5NuEN23RGKfx0/zZ3s2gmreL+A=; b=x4SpFL3N3njUXA8D45SyJEC6Dhl8TKUqjYGCgkDI7YUdegr4ulCyAMC8S6ik3ySbkt iQI4UE3b7R3eEj0Y2PSpjrpxaQxXOfVM7mfQXYVcEGR5BUxl8nH1YQk1LnopI3YrFASE L43HGJyHP3Z5DlDWeTZuff8zvOa1AUq6MD4kBwwdlHplv2EXSLiIt9j8/ZiKXrQ041DE yqBhFlr4Toiohx7NNya5bOrAF2YXY4lt5g5AD75l8jx5OTccJD+qsyYdgJ+mbWwd/DeJ CP7bCpn+2am9gr+/AtmkluWX+Li5teSnCfMTYtMEjHfan2xEggalp+q3rctmByGAXP6H 3EOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y22-20020a056402135600b0051e0d7f1e3esi2523009edw.419.2023.07.14.11.29.00; Fri, 14 Jul 2023 11:29:01 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4008568C665; Fri, 14 Jul 2023 21:28:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 598DF68C541 for ; Fri, 14 Jul 2023 21:28:36 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id F2316C0217 for ; Fri, 14 Jul 2023 21:28:35 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 14 Jul 2023 21:28:31 +0300 Message-Id: <20230714182835.66326-3-remi@remlab.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <12243004.O9o76ZdvQC@basile.remlab.net> References: <12243004.O9o76ZdvQC@basile.remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/7] checkasm: make perf macros functional X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: cnmZAxspGOeO This converts the bench/perf start/stop macros into functional macros, and for that to work, take the Linux perf code out of line. --- tests/checkasm/checkasm.c | 24 ++++++++++++++++++++---- tests/checkasm/checkasm.h | 36 +++++++++++++----------------------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index bfc0a48079..69a709175f 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -515,11 +515,9 @@ static int measure_nop_time(void) int i, nop_sum = 0; av_unused const int sysfd = state.sysfd; - uint64_t t = 0; for (i = 0; i < 10000; i++) { - PERF_START(t); - PERF_STOP(t); - nops[i] = t; + uint64_t t = checkasm_bench_start(); + nops[i] = checkasm_bench_stop() - t; } qsort(nops, 10000, sizeof(uint16_t), cmp_nop); @@ -653,6 +651,24 @@ static void print_cpu_name(void) } #if CONFIG_LINUX_PERF +uint64_t checkasm_bench_linux_perf_start(void) +{ + int fd = state.sysfd; + + ioctl(fd, PERF_EVENT_IOC_RESET, 0); + ioctl(fd, PERF_EVENT_IOC_ENABLE, 0); + return 0; +} + +uint64_t checkasm_bench_linux_perf_stop(void) +{ + uint64_t t; + int fd = state.sysfd; + + ioctl(fd, PERF_EVENT_IOC_DISABLE, 0); + return (read(fd, &t, sizeof(t)) == sizeof (t)) ? t : 0; +} + static int bench_init_linux(void) { struct perf_event_attr attr = { diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 117d4dd35c..8a62b98f3e 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -238,25 +238,20 @@ typedef struct CheckasmPerf { int iterations; } CheckasmPerf; -#if defined(AV_READ_TIME) || CONFIG_LINUX_PERF || CONFIG_MACOS_KPERF - #if CONFIG_LINUX_PERF -#define PERF_START(t) do { \ - ioctl(sysfd, PERF_EVENT_IOC_RESET, 0); \ - ioctl(sysfd, PERF_EVENT_IOC_ENABLE, 0); \ -} while (0) -#define PERF_STOP(t) do { \ - int ret; \ - ioctl(sysfd, PERF_EVENT_IOC_DISABLE, 0); \ - ret = read(sysfd, &t, sizeof(t)); \ - (void)ret; \ -} while (0) +uint64_t checkasm_bench_linux_perf_start(void); +uint64_t checkasm_bench_linux_perf_stop(void); +#define checkasm_bench_start() checkasm_bench_linux_perf_start() +#define checkasm_bench_stop() checkasm_bench_linux_perf_stop() #elif CONFIG_MACOS_KPERF -#define PERF_START(t) t = ff_kperf_cycles() -#define PERF_STOP(t) t = ff_kperf_cycles() - t +#define checkasm_bench_start() ff_kperf_cycles() +#define checkasm_bench_stop() ff_kperf_cycles() +#elif defined (AV_READ_TIME) +#define checkasm_bench_start() AV_READ_TIME() +#define checkasm_bench_stop() AV_READ_TIME() #else -#define PERF_START(t) t = AV_READ_TIME() -#define PERF_STOP(t) t = AV_READ_TIME() - t +#define checkasm_bench_start() UINT64_C(0) +#define checkasm_bench_stop() UINT64_C(0) #endif /* Benchmark the function */ @@ -270,12 +265,12 @@ typedef struct CheckasmPerf { int ti, tcount = 0;\ uint64_t t = 0; \ for (ti = 0; ti < BENCH_RUNS; ti++) {\ - PERF_START(t);\ + t = checkasm_bench_start(); \ tfunc(__VA_ARGS__);\ tfunc(__VA_ARGS__);\ tfunc(__VA_ARGS__);\ tfunc(__VA_ARGS__);\ - PERF_STOP(t);\ + t = checkasm_bench_stop() - t;\ if (t*tcount <= tsum*4 && ti > 0) {\ tsum += t;\ tcount++;\ @@ -286,11 +281,6 @@ typedef struct CheckasmPerf { perf->iterations++;\ }\ } while (0) -#else -#define bench_new(...) while(0) -#define PERF_START(t) while(0) -#define PERF_STOP(t) while(0) -#endif #define DECL_CHECKASM_CHECK_FUNC(type) \ int checkasm_check_##type(const char *const file, const int line, \ From patchwork Fri Jul 14 18:28:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 42684 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp3863490pzb; Fri, 14 Jul 2023 11:29:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlGSKrFtlDtAqQdDv09chWXV0Noflng3NpB+KkEw/0pUwLcAXDoVNCe5jd8TUTTuAYm4tdco X-Received: by 2002:a17:906:6492:b0:973:d06d:545f with SMTP id e18-20020a170906649200b00973d06d545fmr4706262ejm.24.1689359349947; Fri, 14 Jul 2023 11:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689359349; cv=none; d=google.com; s=arc-20160816; b=ogk1YxFPGHkzCzt4DjzQzvd9J0uHBucy14laYtQkFYM3hgm/oJwrr0/lOuuQw/vOXI D3GNDbUEWG/KqfaE61Dg0uD9W5rd2YojiPSN4oghi1vWC6ddALzRU5/Xa+8GE2ga5ZUQ xP0E1xrN+lFF8O+WoxrWJnslMXsQWuyIpCcg/Vsnz8lwxbPrG3riPys2spmzdbXXWTRx +eP69PTM9KIvn8qWTJ8TE9exr+06mGdqin6rorkvnqYLbRJLNCTRLmaLvnyXjVDVKNIj m+jhl20fwciCY4rlOeN5D9lrStD0xj3fc3vB1vcqmbzxbBxWRThtbzf4xpslxPsB/Xr/ 2zHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=PPrGpiQy+wyrBvYldZ79u/iJQaTdbbCDPPr7F59fa5I=; fh=hQcp50obTJ8bXC1it5NuEN23RGKfx0/zZ3s2gmreL+A=; b=BY2HFdNZ+5LO+RBnn2lLjnM0EZYAhlmzjGtpoXsICkthx9kJyrujZjp7W/Jdsnssea 65xaDZtqg+kXtJrxgyAMwK7bEKN/y1N+9En6E+zizIWctSEo3HG14LUDvWkyKkIpDkfD Rl284FKUxi9ezxAr8zRqpH5WgbWO26a61gn7Hopod8z7FQIXadzrzWu3KftfEplZ6/Sn ZYJuyZ8sSJSCzS7Av/aG3Ykob9LmbfKzzGfHsAqljSD01IT1mILVdfxGH80Fb9Moy5WT u3RpXYt9Q3d+/y4z07CCpUSj5gEvbuCcLTiTS9XaTr13ZxlQEufkoYq3xavA5IyA17GB lzFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id gh7-20020a170906e08700b0099238b86ef1si9800643ejb.164.2023.07.14.11.29.09; Fri, 14 Jul 2023 11:29:09 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6011068C67C; Fri, 14 Jul 2023 21:28:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9EA7668C541 for ; Fri, 14 Jul 2023 21:28:36 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 33458C0218 for ; Fri, 14 Jul 2023 21:28:36 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 14 Jul 2023 21:28:32 +0300 Message-Id: <20230714182835.66326-4-remi@remlab.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <12243004.O9o76ZdvQC@basile.remlab.net> References: <12243004.O9o76ZdvQC@basile.remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/7] checkasm: use pointers for start/stop functions X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: xcaOWi/UxpKx This makes all calls to the bench start and stop functions via function pointers. While the primary goal is to support run-time selection of the performance measurement back-end in later commits, this has the side benefit of containing platform dependencies in to checkasm.c and out of checkasm.h. --- tests/checkasm/checkasm.c | 33 ++++++++++++++++++++++++++++----- tests/checkasm/checkasm.h | 31 ++++--------------------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 69a709175f..4b6164301a 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -57,6 +57,14 @@ #if HAVE_UNISTD_H #include #endif +#if CONFIG_LINUX_PERF +#include +#include +#include +#endif +#if CONFIG_MACOS_KPERF +#include "libavutil/macos_kperf.h" +#endif #if !HAVE_ISATTY #define isatty(fd) 1 @@ -508,6 +516,9 @@ static int cmp_nop(const void *a, const void *b) return *(const uint16_t*)a - *(const uint16_t*)b; } +static uint64_t (*checkasm_bench_start)(void); +static uint64_t (*checkasm_bench_stop)(void); + /* Measure the overhead of the timing code (in decicycles) */ static int measure_nop_time(void) { @@ -651,7 +662,7 @@ static void print_cpu_name(void) } #if CONFIG_LINUX_PERF -uint64_t checkasm_bench_linux_perf_start(void) +static uint64_t checkasm_bench_linux_perf_start(void) { int fd = state.sysfd; @@ -660,7 +671,7 @@ uint64_t checkasm_bench_linux_perf_start(void) return 0; } -uint64_t checkasm_bench_linux_perf_stop(void) +static uint64_t checkasm_bench_linux_perf_stop(void) { uint64_t t; int fd = state.sysfd; @@ -687,24 +698,34 @@ static int bench_init_linux(void) perror("perf_event_open"); return -1; } + checkasm_bench_start = checkasm_bench_linux_perf_start; + checkasm_bench_stop = checkasm_bench_linux_perf_stop; return 0; } #elif CONFIG_MACOS_KPERF static int bench_init_kperf(void) { ff_kperf_init(); + checkasm_bench_start = checkasm_bench_stop = ff_kperf_cycles; return 0; } -#else +#elif defined (AV_READ_TIME) +static uint64_t ff_read_time(void) +{ + return AV_READ_TIME(); +} + static int bench_init_ffmpeg(void) { -#ifdef AV_READ_TIME printf("benchmarking with native FFmpeg timers\n"); + checkasm_bench_start = checkasm_bench_stop = ff_read_time; return 0; +} #else +static int bench_init_ffmpeg(void) +{ fprintf(stderr, "checkasm: --bench is not supported on your system\n"); return -1; -#endif } #endif @@ -871,6 +892,8 @@ CheckasmPerf *checkasm_get_perf_context(void) CheckasmPerf *perf = &state.current_func_ver->perf; memset(perf, 0, sizeof(*perf)); perf->sysfd = state.sysfd; + perf->start = checkasm_bench_start; + perf->stop = checkasm_bench_start; return perf; } diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 8a62b98f3e..4962815345 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -26,15 +26,6 @@ #include #include "config.h" -#if CONFIG_LINUX_PERF -#include // read(3) -#include -#include -#include -#elif CONFIG_MACOS_KPERF -#include "libavutil/macos_kperf.h" -#endif - #include "libavutil/avstring.h" #include "libavutil/cpu.h" #include "libavutil/internal.h" @@ -236,24 +227,10 @@ typedef struct CheckasmPerf { int sysfd; uint64_t cycles; int iterations; + uint64_t (*start)(void); + uint64_t (*stop)(void); } CheckasmPerf; -#if CONFIG_LINUX_PERF -uint64_t checkasm_bench_linux_perf_start(void); -uint64_t checkasm_bench_linux_perf_stop(void); -#define checkasm_bench_start() checkasm_bench_linux_perf_start() -#define checkasm_bench_stop() checkasm_bench_linux_perf_stop() -#elif CONFIG_MACOS_KPERF -#define checkasm_bench_start() ff_kperf_cycles() -#define checkasm_bench_stop() ff_kperf_cycles() -#elif defined (AV_READ_TIME) -#define checkasm_bench_start() AV_READ_TIME() -#define checkasm_bench_stop() AV_READ_TIME() -#else -#define checkasm_bench_start() UINT64_C(0) -#define checkasm_bench_stop() UINT64_C(0) -#endif - /* Benchmark the function */ #define bench_new(...)\ do {\ @@ -265,12 +242,12 @@ uint64_t checkasm_bench_linux_perf_stop(void); int ti, tcount = 0;\ uint64_t t = 0; \ for (ti = 0; ti < BENCH_RUNS; ti++) {\ - t = checkasm_bench_start(); \ + t = perf->start(); \ tfunc(__VA_ARGS__);\ tfunc(__VA_ARGS__);\ tfunc(__VA_ARGS__);\ tfunc(__VA_ARGS__);\ - t = checkasm_bench_stop() - t;\ + t = perf->stop() - t;\ if (t*tcount <= tsum*4 && ti > 0) {\ tsum += t;\ tcount++;\ From patchwork Fri Jul 14 18:28:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 42685 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp3863547pzb; Fri, 14 Jul 2023 11:29:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlGT9xw93zaQHfcmOMIKmelD0M9/GZRcivY7desIruxup1LR82P7dMyThai/a9w0OBRdR1UH X-Received: by 2002:a17:906:2d6:b0:982:c8d0:683f with SMTP id 22-20020a17090602d600b00982c8d0683fmr4495466ejk.18.1689359358243; Fri, 14 Jul 2023 11:29:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689359358; cv=none; d=google.com; s=arc-20160816; b=E41w/U7AAKloG2alktI3EuR/tVIQKdZc1YCOwrvmb392idw8EfocCfMUOM8AnThFxa SC1CFZsc2CgOG5i4ugUUmQpNVfQueTgJCr0qConhBVbszgzevRlFFh1FtSbDymmj5QzE mEUTo3RA0+LC6YUSqapPRWLV0fV2ROXG++BQP8W1rIeLU7I5zTWzSWnpdwFT/POwhCNQ gUu79EDtwSyxsW1TkCmik2S887jzo+oH2uNF+qAETE3w7w6xiOlC2B5Egppx32Y3Cors 9sCzzhql6NcCvhAawS1ow/+crIkxul5caqKpTY9GkKO1a2dGOBcORj02CdwQtyJbXCJX S1mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=SrPrcgshmDPfTA/98TmOGF8DQbzodJpr2yJQGbUKNfM=; fh=hQcp50obTJ8bXC1it5NuEN23RGKfx0/zZ3s2gmreL+A=; b=WQP+XkEyoiwGr6ukqwStd4iRpxk1ynEDog+7C/wRVJWSmwEk/31neW5H9cbXg+pqkp DU6qpyforNGNhDnV/RRgRLJmBpzA8OqUvisM7thyeWOEbhBa4vNXhpA9rKP6AK+Fublt dN0XZTtrL/3xJpcouibp9H9ZXnq3hetD06DPwt3v02g5noKAHRiwDyCKAcfQpNPimBHD BhJZSNmRi6bcLzh94ftjoMu/zXtVgAV4Vk6lnPEhgScBH3t5ZogdALuePgoFqkac67mm RU3CpbdSvM2J21FWDS0adGz2jDpfH/2YmDQW7rHH6MZzjalWQq/RTBBVaT6YToE3i9o6 W95Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n21-20020a170906841500b00988a5cdbfa7si8760511ejx.889.2023.07.14.11.29.17; Fri, 14 Jul 2023 11:29:18 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5A02468C685; Fri, 14 Jul 2023 21:28:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C457368C541 for ; Fri, 14 Jul 2023 21:28:36 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 68872C0219 for ; Fri, 14 Jul 2023 21:28:36 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 14 Jul 2023 21:28:33 +0300 Message-Id: <20230714182835.66326-5-remi@remlab.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <12243004.O9o76ZdvQC@basile.remlab.net> References: <12243004.O9o76ZdvQC@basile.remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/7] checkasm: remove unused variable X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 3LW5pOnARik/ --- tests/checkasm/checkasm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 4b6164301a..c3075fe37c 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -524,7 +524,6 @@ static int measure_nop_time(void) { uint16_t nops[10000]; int i, nop_sum = 0; - av_unused const int sysfd = state.sysfd; for (i = 0; i < 10000; i++) { uint64_t t = checkasm_bench_start(); From patchwork Fri Jul 14 18:28:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 42687 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp3863687pzb; Fri, 14 Jul 2023 11:29:35 -0700 (PDT) X-Google-Smtp-Source: APBJJlFkKDxY6XC42jgGF/Ck4eLcpzuyvjsqczSA+2e+0SNdiFCznJk0LYzZIMerbavJCgng8ApH X-Received: by 2002:aa7:df04:0:b0:519:b784:b157 with SMTP id c4-20020aa7df04000000b00519b784b157mr4692164edy.12.1689359375288; Fri, 14 Jul 2023 11:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689359375; cv=none; d=google.com; s=arc-20160816; b=gkqIW14RRjt7cSZ3Tlu792FaZLnGp8iA9cAHZCGPLMOSaI0xL33BXecAQnZ46Tz3Bv 30tbKaHKUIViivGGupjlyU6O1tELqc3VWyhbL6U+IumOD2NtoEeIa8P69SdflJqal9s3 P+FZXb1gDJsKWtv5AzOXWmV308UHzxmimrET4BPvzAlgbsA387cj1q+0Dzn0piDr0pSk sc2V6pyrDIoFaGhBCj71tep6wpQrYwfookNuktriQAhj9ITqFo1j9nlee3Td1LeWATXI OfPvFEOaCk+oBuNXlC+21rh8Gapzb9HV+ZAaTpplJkkm54xusycXdr/zHktBlkXwocX8 fHzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=hO/pdb7sp/oubN68WfYk11BX0f/uU9ngn6LW27ipgrQ=; fh=hQcp50obTJ8bXC1it5NuEN23RGKfx0/zZ3s2gmreL+A=; b=by9aq6cQg8R1riXyQCmHe/V1sNmjUP870rE2al7YitwA4Fk5HSr6oQya+rD67PdIiV QM0yNXTW1AT7N5E8Y+zTfJhNhD0k4ZRTWNgCHLcFc1z6Ac+1PeZ64vnqU3bzkBYo0Pwx WI6VJHG3snRzcDTI6LkEkL2iBVGU1l/KQ9GP6Sfpq6390cQ4zaK717e04MwrMYDikcQi Q8drN912dIGUHLLxLaRc93GAfwFsZdasa7uym2UpvwqJED4GltWTvu3LqCVGQqNemtQy 7VqurpMyKqBdIq1FQKrMiYAu9EYP3+0nxF3HQkm13ZGSic4OjVHGYwteyKtALFJzwxup Omhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v22-20020aa7d656000000b0051ff1fb2631si3080092edr.416.2023.07.14.11.29.34; Fri, 14 Jul 2023 11:29:35 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3F11B68C4CE; Fri, 14 Jul 2023 21:28:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4CACB68C678 for ; Fri, 14 Jul 2023 21:28:41 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 9383AC021A for ; Fri, 14 Jul 2023 21:28:36 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 14 Jul 2023 21:28:34 +0300 Message-Id: <20230714182835.66326-6-remi@remlab.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <12243004.O9o76ZdvQC@basile.remlab.net> References: <12243004.O9o76ZdvQC@basile.remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/7] checkasm: allow run-time fallback to AV_READ_TIME X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: UMSeVBQeTjTs On Linux RISC-V, depending on kernel version and configuration, the cycle counters may be available: - via Linux perf (as on Arm), - directly with RDCYCLE (which is considered legacy), - neither (if admistratively disabled), or - or both (in legacy compatibility mode). This allows to try Linux perf, with a fallback to RDCYCLE. Without this, bench will stop working in upcoming kernel releases. --- tests/checkasm/checkasm.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index c3075fe37c..d72850f076 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -701,7 +701,8 @@ static int bench_init_linux(void) checkasm_bench_stop = checkasm_bench_linux_perf_stop; return 0; } -#elif CONFIG_MACOS_KPERF +#endif +#if CONFIG_MACOS_KPERF static int bench_init_kperf(void) { ff_kperf_init(); @@ -720,25 +721,27 @@ static int bench_init_ffmpeg(void) checkasm_bench_start = checkasm_bench_stop = ff_read_time; return 0; } -#else -static int bench_init_ffmpeg(void) -{ - fprintf(stderr, "checkasm: --bench is not supported on your system\n"); - return -1; -} #endif static int bench_init(void) { + int ret = -1; #if CONFIG_LINUX_PERF - int ret = bench_init_linux(); -#elif CONFIG_MACOS_KPERF - int ret = bench_init_kperf(); -#else - int ret = bench_init_ffmpeg(); + if (ret < 0) + ret = bench_init_linux(); +#endif +#if CONFIG_MACOS_KPERF + if (ret < 0) + ret = bench_init_kperf(); #endif +#ifdef AV_READ_TIME if (ret < 0) - return ret; + ret = bench_init_ffmpeg(); +#endif + if (ret < 0) { + fputs("checkasm: --bench is not supported on your system\n", stderr); + return -1; + } state.nop_time = measure_nop_time(); printf("nop: %d.%d\n", state.nop_time/10, state.nop_time%10); From patchwork Fri Jul 14 18:28:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 42686 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp3863611pzb; Fri, 14 Jul 2023 11:29:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlEsGQxV+CLXB0Ptl6jtWuSu/NM11hCp8Qu4jWw/82HYkvTsAGFy0MkpVgbL3H37T/L5Qc/P X-Received: by 2002:aa7:d852:0:b0:521:6275:c9af with SMTP id f18-20020aa7d852000000b005216275c9afmr2888963eds.7.1689359366308; Fri, 14 Jul 2023 11:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689359366; cv=none; d=google.com; s=arc-20160816; b=OsuSMYgTY0J7Xcr+dVJF9XM/6oEYfKAizuewCuyjB91DRDK6mA2yElddpAxJ9Nccks vzht0WrA7ylSFWsWI21LRwpXz86oCj464BXP86ant7THf6X2m4eaIGfbHO0F9crk/o5A 5Qd0uhLn0sCdg7fOq6Oouz8zKdYHa4DYLz/FoFetRI+KclnA+TrKCbHS3aPtwZ4gxcfG PClWQ9XOm9CHK8lgJ+chUa1OYyJuQBtVucz+YiHT8rHpiKJlYICndPeqdLsUFEeq8fTV v/8GaPpDtf4qDwWo+C5nk60vZuIPvSB850gYNQNF40dX+dkLBynJ5xYlN62d+PNFY5A8 hTdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=HPQ24dS0ZCyrftpS1rve03+nLXjSs+0U91CjBifKcE4=; fh=hQcp50obTJ8bXC1it5NuEN23RGKfx0/zZ3s2gmreL+A=; b=AKEQkGmJZecTJRQlv1K5Wiykh7aFs50ef+rwtXaTv/5pZ7uHpHl7MpVs5h6eXd4o7p OpQx9YB6uximteeJWaiLXPRErr7HBLQjVsbz/nh/ULmyz01Uc/pWohk0XID6eqLS+Hvh 7ycXDFIdnhwATDp5P/96Zp3xC7EmB+TguoR6gKd4fLE1XeFJRAp8liTB5RQ/3iBXb7IA QB/C5toIcjcZhGSP+W6j0wR6VWw0I4SYCJE148Dyr+BHXb+4lPFjRNhMEogxq0YpFs89 ZyIFw59fQU/IStttvMUPSw+XH2/hOPH6DHoAng1fmKAA1kPAJH863CsPNp2a81Hlvf+x uVIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id x8-20020aa7dac8000000b0051e24907683si9684911eds.321.2023.07.14.11.29.25; Fri, 14 Jul 2023 11:29:26 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 45DA668C686; Fri, 14 Jul 2023 21:28:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 405AA68C675 for ; Fri, 14 Jul 2023 21:28:41 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id BE940C021B for ; Fri, 14 Jul 2023 21:28:36 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 14 Jul 2023 21:28:35 +0300 Message-Id: <20230714182835.66326-7-remi@remlab.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <12243004.O9o76ZdvQC@basile.remlab.net> References: <12243004.O9o76ZdvQC@basile.remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 7/7] configure: enable Linux perf on RISC-V by default X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: x3TtDePgi/Sy Now that checkasm can automatically fall back to RDCYCLE, it is safe to enable this for forward compatibility with kernel versions mitigating the "Cycle Drift" side channel attack. Where available, this should also reduce measurement noise, since kernel and hypervisor cycles should no longer be counted. --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 0ab0761011..3be074e15b 100755 --- a/configure +++ b/configure @@ -5754,7 +5754,7 @@ case $target_os in ;; linux) enable section_data_rel_ro - enabled_any arm aarch64 && enable_weak linux_perf + enabled_any arm aarch64 riscv && enable_weak linux_perf ;; irix*) target_os=irix