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 C42444764F for ; Thu, 16 May 2024 13:10:15 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B95AF68D44A; Thu, 16 May 2024 16:10:12 +0300 (EEST) Received: from fout7-smtp.messagingengine.com (fout7-smtp.messagingengine.com [103.168.172.150]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BD94768AC40 for ; Thu, 16 May 2024 16:10:06 +0300 (EEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfout.nyi.internal (Postfix) with ESMTP id D7EAD13814F8; Thu, 16 May 2024 09:10:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 16 May 2024 09:10:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itanimul.li; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to; s=fm1; t=1715865004; x=1715951404; bh=O6LOJ4Vky06r96cmfJrqL cJ9GOW9GVgH8XpQJItXpYw=; b=dou7GDt4zEDT9kt1GvT60wybh+cJQCQkhg9wh w5RjpSM54Y/pZM1S39+L3skgGov9Zi36yyDn1uBOfIe+QC9PnWLQ8IxFySROJt9I J4cYNBTNKTqnhfDSge3PrbOXDD/uxPDsnChXvJX4m9WFhFKUq4FFNLxm00rBFGLc JaK3KY/rfkrWa2wQOiMVpFI6Q9/Las8wafbvRuH2zju1SCf6AdXCPYXblchfMaAZ E+36IfCj0dhTTOcXNnssDCDflzE10Y6/McUwHFUfqT8kuJ5B8LaPMx8s3MWECjV8 diyhBXwpeF6lwDG6VerYt9QZpBNzjUGxNTlVTUyfPlOkTmfJg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1715865004; x=1715951404; bh=O6LOJ4Vky06r96cmfJrqLcJ9GOW9 GVgH8XpQJItXpYw=; b=Rx5D8L5vXdUokuNhd/0WKWfEcRTgoTCAMvZM6VRTi297 OC1q5lFdxCCKSA0o2KMCilIANhVuHMBHiUVvAuKPH8QCOczKqyUJsx1+grqRyfGB WA41lNR2pAmx+H9/X3V1FPbCrUaaEcktCXEpm3V9G4DXMvF0Rus8sCGkSE/Rb+fz 3edWU9Pk4QAaVUNfBXCKGVzGtmtpxbxmMp0NgJ/w4hRDhgCyvIzvNvD3tcpxYd1D ErsFIBY2i1yQEsCa8noGWWGmnKBVq9+rUkDWgVfBPqz6gHpRpgeaNpNcNmYvh0mk YhbzDTebMxwwj0aXQajNpJknfKDRZMvL6z2ZM3KH5w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdehuddgheelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffoggfgsedtkeertd ertddtnecuhfhrohhmpedflfdrucffvghkkhgvrhdfuceojhguvghksehithgrnhhimhhu lhdrlhhiqeenucggtffrrghtthgvrhhnpeejtefhhfefhfehveefleejleffkeekkeeuvd duffekudejgfdtffehleelhfdvueenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpehjuggvkhesihhtrghnihhmuhhlrdhlih X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 May 2024 09:10:03 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 May 2024 15:09:49 +0200 Message-ID: <20240516130956.20294-1-jdek@itanimul.li> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] 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 Cc: "J. Dekker" 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 (--samples) has been added, allowing developers to increase or adjust the sample count for more reliable results. Signed-off-by: J. Dekker --- This could also be implemented as a compile time define or a configure argument. tests/checkasm/checkasm.c | 12 +++++++++++- tests/checkasm/checkasm.h | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index ffc89882b1..c31adc3690 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 = 1000; + /* List of tests to invoke */ static const struct { const char *name; @@ -819,7 +822,7 @@ static void bench_uninit(void) static int usage(const char *path) { fprintf(stderr, - "Usage: %s [--bench] [--test=] [--verbose] [seed]\n", + "Usage: %s [--bench] [--samples=] [--test=] [--verbose] [seed]\n", path); return 1; } @@ -866,6 +869,13 @@ 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, "--samples=", 10)) { + l = strtoul(arg + 10, &end, 10); + if (*end == '\0') { + bench_runs = 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..11f07a919f 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__)) @@ -339,7 +339,7 @@ typedef struct CheckasmPerf { int ti, tcount = 0;\ uint64_t t = 0; \ checkasm_set_signal_handler_state(1);\ - for (ti = 0; ti < BENCH_RUNS; ti++) {\ + for (ti = 0; ti < bench_runs; 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".