From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id D390F4ADE0 for ; Tue, 21 May 2024 13:51:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E737768D2BA; Tue, 21 May 2024 16:51:25 +0300 (EEST) Received: from wfhigh8-smtp.messagingengine.com (wfhigh8-smtp.messagingengine.com [64.147.123.159]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0BBB968D21C for ; Tue, 21 May 2024 16:51:19 +0300 (EEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.west.internal (Postfix) with ESMTP id 6DC8C1800180 for ; Tue, 21 May 2024 09:51:17 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 21 May 2024 09:51:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itanimul.li; h= cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1716299477; x= 1716385877; bh=7SMMBHmWQlqKCyczfCZMmzxklzt7dTIB/ywZhcfe3yw=; b=S oUUD4Kqy3wkOlQiVG0v2sTk7mhEcev3i9e+7tpn6O/76mVD5gn6//AG46lVW4qkk Oii7m25wdhgOlmJCCeXYAs3i+YXKJDIJZI0cM8wTGAOAqu29AFlwzX6xOkbhux/9 SjSyY03VTHIY1CJBnBkwvk2Mmy9Cfhfk0QqGruoTxSsnTd/L92DzJLv7Wf6rRMSP lMVKPaASemnlrU9gOiFJ9iNa9uNS0Sq4O/DtkPYtoM4/aAH5J0PvBYg5FGdHOdXG hzW96KIBAMD5NzyoWfrMeAw/eD5FksLeyoT9f0gqPBo0dK3j0tl5fZ1U1Rqcl2dt nsZuGmkIedKkZIGyUMbnA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1716299477; x=1716385877; bh=7SMMBHmWQlqKC yczfCZMmzxklzt7dTIB/ywZhcfe3yw=; b=qSlZlDOmgLX8ZQDlQTI6NbzUM5u+8 PBAjG64g/roUgcac28T2SjGbPYmukU4hdn21VaLC5nhc5pXihZePLQlD43WSSP7b 2mCnN9Qo61ta8eyHjWx4JarHwmaMwgiJUIqMyvVXrGgp5KahOss1kqhQjqAwdmF+ xpWYo6vhVabjuzzR9xC192Hi31CzkzvDBr6FFjLcsHmsfII08eQrvyKkmgwRGGLb R7J3OiJ1vjYdES4j6NoZQRFiQaATj3qIOvaY2kVqcDzGMDeFEamVXB/I+WcqFQsN wXRZao5td8uMkI780mmBjnbtd32rps8W00Nxxrv4QTcCHpsRh3VFxHftw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeivddgieejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepfdflrdcuffgvkhhkvghrfdcuoehjuggvkhesihhtrghnihhm uhhlrdhliheqnecuggftrfgrthhtvghrnhepgedvhfffuddugeehveeikeeifeefgfevff ektdehkeeifefhveeuteeufefhteetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepjhguvghksehithgrnhhimhhulhdrlhhi X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 21 May 2024 09:51:16 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Tue, 21 May 2024 15:51:14 +0200 Message-ID: <20240521135114.40265-1-jdek@itanimul.li> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3] checkasm: add sample argument to adjust during bench 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Some timers on certain device and test combinations can produce noisy results, affecting the reliability of performance measurements. One notable example of this is the Canaan K230 RISC-V development board. An option to adjust the number of samples by an exponent (--runs) has been added, allowing developers to increase the sample count for more reliable results. Signed-off-by: J. Dekker --- tests/checkasm/checkasm.c | 16 +++++++++++++++- tests/checkasm/checkasm.h | 7 ++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 31ca9f6e2b..669f2be9c1 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -72,6 +72,9 @@ void (*checkasm_checked_call)(void *func, int dummy, ...) = checkasm_checked_call_novfp; #endif +/* Trade-off between speed and accuracy */ +uint64_t bench_runs = 1U << 10; + /* List of tests to invoke */ static const struct { const char *name; @@ -820,7 +823,7 @@ static void bench_uninit(void) static int usage(const char *path) { fprintf(stderr, - "Usage: %s [--bench] [--test=] [--verbose] [seed]\n", + "Usage: %s [--bench] [--runs=] [--test=] [--verbose] [seed]\n", path); return 1; } @@ -867,6 +870,17 @@ int main(int argc, char *argv[]) state.test_name = arg + 7; } else if (!strcmp(arg, "--verbose") || !strcmp(arg, "-v")) { state.verbose = 1; + } else if (!strncmp(arg, "--runs=", 7)) { + l = strtoul(arg + 7, &end, 10); + if (*end == '\0') { + if (l > 30) { + fprintf(stderr, "checkasm: error: runs exponent must be within the range 0 <= 30\n"); + usage(argv[0]); + } + bench_runs = 1U << l; + } else { + return usage(argv[0]); + } } else if ((l = strtoul(arg, &end, 10)) <= UINT_MAX && *end == '\0') { seed = l; diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 07fcc751ff..e05053cbf6 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -167,7 +167,7 @@ extern AVLFG checkasm_lfg; static av_unused void *func_ref, *func_new; -#define BENCH_RUNS 1000 /* Trade-off between accuracy and speed */ +extern uint64_t bench_runs; /* Decide whether or not the specified function needs to be tested */ #define check_func(func, ...) (checkasm_save_context(), func_ref = checkasm_check_func((func_new = func), __VA_ARGS__)) @@ -336,10 +336,11 @@ typedef struct CheckasmPerf { av_unused const int sysfd = perf->sysfd;\ func_type *tfunc = func_new;\ uint64_t tsum = 0;\ - int ti, tcount = 0;\ + uint64_t ti, tcount = 0;\ uint64_t t = 0; \ + const uint64_t truns = bench_runs;\ checkasm_set_signal_handler_state(1);\ - for (ti = 0; ti < BENCH_RUNS; ti++) {\ + for (ti = 0; ti < truns; ti++) {\ PERF_START(t);\ tfunc(__VA_ARGS__);\ tfunc(__VA_ARGS__);\ -- 2.42.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".