From patchwork Wed Aug 21 11:18:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 51099 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:4062:b0:48e:c0f8:d0de with SMTP id kz34csp357846vqb; Wed, 21 Aug 2024 04:26:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXTggUDBFUtT0G9AT95lGg/vO+w1+cjzwUCA559NxEwQsx+EbQX7xR0/aSrRjfDPpQga7w2p7JAVSOMR+S+cTZh@gmail.com X-Google-Smtp-Source: AGHT+IF37KkU5sW+xl7NNtuNNp9bQHax/mZ/309+TapR39SGCARZqV0WKB7/+v8G4xhWH/awIWd3 X-Received: by 2002:a17:907:1b09:b0:a86:68a1:6a08 with SMTP id a640c23a62f3a-a866f3550dfmr153068066b.29.1724239577413; Wed, 21 Aug 2024 04:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724239577; cv=none; d=google.com; s=arc-20160816; b=EDmguGOMEqX5sxR11mI5nnnyANUPj5eF0xMrRj4U0vXcRrhSM2FUN3nGFFXYKCoqjl jKYXMuz0ZrdHeVsPClXxeSTnx+i3SFUVOTtUDXx2tEGtmumfUyUJg/qRcPQOY+KwlCI8 ZI1JYIAf7hPIg9gbH3s2px4TvatWY4qdoaAGcvxTZTeZ7FmrndznVhMjAoD3vKgGIcDf fzzlhBvOfoQfN1xhMWVUF3HIUcSx8JPNRpUdP8+6Pp0WYKbnQnAsWkem6K4OyAdcjcz1 wFsApi9oFiGxugTpeAQa1pQUwiKyELwQ0T59TocQKkrm3JeZ+06HH7lYLC7QBLp3Tg/9 bwVw== 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:message-id:date:to:from:feedback-id :dkim-signature:dkim-signature:delivered-to; bh=sIlFCyoMxzPyopFp6Y5TdtClIyS10AOAkBh68KgY/6s=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=wVabmwxV0qVRwOK5mshVkSxUB3g/rgAfr5pK50SgRsaSRTQyoAYBWUAju5utSaOiM/ /tJfDuEXWTs4Z7q/hT78E4dMxtI2E60K+kuewYW2HXLcsRijnE3+P3+w0kqEcJnqmwv9 acKFIOZNfMxPueTEO0vWOl6/hs75t4m3Dplf2/NzwUprgOzUK+z2JFH5MvUkTpj54/8Z uranYnE5x+Ek44n3R+iFXCwpMLM40cMAtN46vXbcCvrLsxzRPrihPNDdMCq7hRZpPzPq vdkIl/kdQ3g92fUvEysbKJdjKxBIl7/oykWsXas8+wG30w1bErrn9CMj67hSybbUkc5o mELw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm2 header.b=igbaWk5J; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm1 header.b="MXcKB/GU"; 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 a640c23a62f3a-a83838d0109si854143266b.239.2024.08.21.04.26.16; Wed, 21 Aug 2024 04:26:17 -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; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm2 header.b=igbaWk5J; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm1 header.b="MXcKB/GU"; 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 35D1468DBBB; Wed, 21 Aug 2024 14:18:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from fhigh5-smtp.messagingengine.com (fhigh5-smtp.messagingengine.com [103.168.172.156]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E523B68D977 for ; Wed, 21 Aug 2024 14:18:37 +0300 (EEST) Received: from phl-compute-02.internal (phl-compute-02.nyi.internal [10.202.2.42]) by mailfhigh.nyi.internal (Postfix) with ESMTP id C83101151BB1 for ; Wed, 21 Aug 2024 07:18:36 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Wed, 21 Aug 2024 07:18:36 -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:message-id:mime-version:reply-to:subject:subject:to :to; s=fm2; t=1724239116; x=1724325516; bh=S5OKRqGayBDY8uNJm8BOX nxMPQTWiUMDRkf7rhXdxLI=; b=igbaWk5JX68pf9w1K1CmY3MtK4j5EXWQyLPaQ URLljRwKL1pTbJlawSaNPOkSAtpTD95m+/NQ0Dh6D3HK/0GPDnJEN4DNxOtXJgau 8WkR4pUrCpfHq6C++/LFqBtkZpNofBxhOibFKRmOuJ9WKYwUsKLg7uAgjssdOWvk dmLkib/mjXNs8tDKwiJg2YA/XuDIZkLkDq0ZY3GHQolXNODuTsNmd/R9+dLfVuW8 S/akpV96N0q1foLOmfZI0SMxUrn/TxbDL5EVr6oecF2v+oOyDskQCxvAXXoGHMA4 DocCabIzrTrYbew2dqlCGrar+nSTYR0mGtMF3tAOuIRqmRG1A== 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 :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= fm1; t=1724239116; x=1724325516; bh=S5OKRqGayBDY8uNJm8BOXnxMPQTW iUMDRkf7rhXdxLI=; b=MXcKB/GUd4PDKKmIEjHTgWmtIb88ChZRcItNikbGLkpD +gf8FeGSO1RV4Eshanoe3RoNfi/MSlL7zuunD/lCE080M2Zsw4V6cnX0Q9sd6V1f qbeXZqEMKEuAjftL8l8p8FX/KbgB8HQTiqcRtKh0MXBfeoY3InkoOGvrw5nXrBbm liG/NDzkQNtPuNSYtiGhuIVtI+9XmdTjwB+q+Xz2Pp5DHlsUvqznFra8nCzilvCj URhNPUAE9fogAoDdkdGu2jzbmpqK8p3Y7rupt47ag1g9ektvJ2TB8nIy7rAFe3dd GJtv9QOs0WZKxh7J1BeBvrRo0VcOE3GKaFSP4Y0WTA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddukedgfeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuff fkofgggfestdekredtredttdenucfhrhhomhepfdflrdcuffgvkhhkvghrfdcuoehjuggv khesihhtrghnihhmuhhlrdhliheqnecuggftrfgrthhtvghrnhepueetgfdtuedvjeejje dvteelffeuhedtfeetudfglefhjeeukeetvddvtdevieeinecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhguvghksehithgrnhhimhhulhdrlh hipdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehf fhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 21 Aug 2024 07:18:36 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Wed, 21 Aug 2024 13:18:30 +0200 Message-ID: <20240821111834.81752-1-jdek@itanimul.li> X-Mailer: git-send-email 2.44.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/4] checkasm: add csv/tsv bench output 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: VjlZ2E/oNjbn When collecting performance information from checkasm it is common to parse the output for use in graphs to compare vs different architectures. Signed-off-by: J. Dekker --- tests/checkasm/checkasm.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 58597d3888..d9b5c94faa 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -362,6 +362,8 @@ static struct { const char *cpu_flag_name; const char *test_name; int verbose; + int csv; + int tsv; volatile sig_atomic_t catch_signals; } state; @@ -586,7 +588,14 @@ static void print_benchs(CheckasmFunc *f) CheckasmPerf *p = &v->perf; if (p->iterations) { int decicycles = (10*p->cycles/p->iterations - state.nop_time) / 4; - printf("%s_%s: %d.%d\n", f->name, cpu_suffix(v->cpu), decicycles/10, decicycles%10); + if (state.csv || state.tsv) { + const char sep = state.csv ? ',' : '\t'; + printf("%s%c%s%c%d.%d\n", f->name, sep, + cpu_suffix(v->cpu), sep, + decicycles / 10, decicycles % 10); + } else { + printf("%s_%s: %d.%d\n", f->name, cpu_suffix(v->cpu), decicycles/10, decicycles%10); + } } } while ((v = v->next)); } @@ -829,7 +838,12 @@ static void bench_uninit(void) static int usage(const char *path) { fprintf(stderr, - "Usage: %s [--bench] [--runs=] [--test=] [--verbose] [seed]\n", + "Usage: %s [options...] [seed]\n" + " --test= Run specific test.\n" + " --bench Run benchmark.\n" + " --csv, --tsv Output results in rows of comma or tab separated values.\n" + " --runs= Manual number of benchmark iterations to run 2**.\n" + " --verbose Increase verbosity.\n", path); return 1; } @@ -877,6 +891,10 @@ int main(int argc, char *argv[]) state.bench_pattern = ""; } else if (!strncmp(arg, "--test=", 7)) { state.test_name = arg + 7; + } else if (!strcmp(arg, "--csv")) { + state.csv = 1; state.tsv = 0; + } else if (!strcmp(arg, "--tsv")) { + state.csv = 0; state.tsv = 1; } else if (!strcmp(arg, "--verbose") || !strcmp(arg, "-v")) { state.verbose = 1; } else if (!strncmp(arg, "--runs=", 7)) { From patchwork Wed Aug 21 11:18:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 51097 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:4062:b0:48e:c0f8:d0de with SMTP id kz34csp354065vqb; Wed, 21 Aug 2024 04:19:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUPi4hsvX8SYI3o8xLpIs3ZQRC65FcsNNUef+iDExvLaLJMTtrBrPn8dyeeh/VofP7kuIPJI0RHA3TZntI8IwE5@gmail.com X-Google-Smtp-Source: AGHT+IFgiAGXePrH3rNwvB1VFSISO8M/xDz+3PeD2EZgQR+Ctmph/X2yYYvQ9AilvOrDuLcBqVCs X-Received: by 2002:a05:6402:518d:b0:5bb:9ae0:4a49 with SMTP id 4fb4d7f45d1cf-5bf1f275c15mr1590803a12.30.1724239140099; Wed, 21 Aug 2024 04:19:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724239140; cv=none; d=google.com; s=arc-20160816; b=QfoMpGyRr3mlDSGHHycdox0DY+6salqVO6IXjAWLG04thC1uX7gPyszWam6e/Xsix0 4UWweQ38uyX4qmT8Dksmvs665F7VP5ORyxMNkR6IEdiCByPSwVQFYKw5lY6WDeYxBb7J 8Ln3JpOO77qUDo/a1xs4KsSZHOTOmgkSpdg+mLgCPVjY2riV7O1jYFkOLi534nII8YIu 4w3jTne8g9/nm78427ZwIW+tRQXdZ+o0uk8xAOWJeIsAnAAgsz1AOc/X2yNrR/a0TgbC iHkIHVVGBJ3K8R+28UHKG65O5yYx+lNjnSZYaPVX/VSRDYPlliLO2pWhXlfRvMXgg6ix nYMQ== 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:feedback-id:dkim-signature:dkim-signature:delivered-to; bh=rnHetgSzZDnzlMQQRJCYwwRGTcp/A1D3LyIaoq1P13o=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=VyudsXXKTdvw3mcNR694VvNXDOfR5IOPLz4aohpnWBO7dGkVBi5OWWkVOaoH5jLWba EHIij6xJWEhf0H8oPp09oUfe5GaozfEVK2q8cWgh5GZWnYJLUcDM0YVEGNx6sO/LRVh0 K9WlzSVpJE58gCW/H7qyQPbqYrSqyF84z+C7SrgcjFxSuA8035xFOjpqo8ma/92Acoi1 QZ9c7fKhY8LD1GN30x4Bjak6N00kQMGeQo1WqLeY34MwSBQC+33O1f831G2gibUCa3wu ftTI54hgTPRUDAMQbJaDXGutuHqk2IVksSjUErsv5HgK2W/9/2POCp07q1yHEFhNRBFI tV8w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm2 header.b="S9WWS7k/"; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm1 header.b=Hbkw0xVq; 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 4fb4d7f45d1cf-5bebbbf178fsi8033716a12.41.2024.08.21.04.18.58; Wed, 21 Aug 2024 04:19:00 -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; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm2 header.b="S9WWS7k/"; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm1 header.b=Hbkw0xVq; 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 D83D368DBD1; Wed, 21 Aug 2024 14:18:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from fout2-smtp.messagingengine.com (fout2-smtp.messagingengine.com [103.168.172.145]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C47A868D977 for ; Wed, 21 Aug 2024 14:18:39 +0300 (EEST) Received: from phl-compute-01.internal (phl-compute-01.nyi.internal [10.202.2.41]) by mailfout.nyi.internal (Postfix) with ESMTP id 5A69E138FFA7 for ; Wed, 21 Aug 2024 07:18:38 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Wed, 21 Aug 2024 07:18:38 -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=1724239118; x= 1724325518; bh=w4lww1JXyD8DdVQEFQrmghxuze8Ku0GVxX9GWuJ0r58=; b=S 9WWS7k/hMxJ7gNTrZx6JOFNRC02HWaXtlhWgwgnrvzdWtmEEwQhJoVkIqWHJuJbs 0GLUWwfl+QiOjh/jQs2gww7/ijg5zajxwX2p4SE1CJwZydocjiPO/iS5xEMj1HXe UxJ08Z0KcI/QO8BdCkgTrXDk7MGWwiy8EtWCGaoTOEkU+2+Nc4iTbvz/uC7dUCmA vUP0J6MNH4uXfpgpwVOY+RFHXbNgdkYz2j6hpS+YBHaMpzU8BLFoNK2Jk5fDer/9 kKtYZm72r35Uy5BHF6ilTMOST46gEz+lgKgytelfZ/ULWCk91mO3w2dXkByzPFKc JVgbaJnPeBdD/lsueuHZg== 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=1724239118; x=1724325518; bh=w4lww1JXyD8Dd VQEFQrmghxuze8Ku0GVxX9GWuJ0r58=; b=Hbkw0xVqrSHYbj1zVM/1Qd4k3OlzJ agxylMxCBHbpXhkRLjybB/969ni9rPSiolz246cfhqkksGZye7ni75/LY4jD1gPw W9SEIIgSg/Gw9Ww2NiyF8zjgFZjSKYqjL0wns1Lb2VtviPJebEBj0f+hGXBvr6Ev zIMDFnQgvAJeA7xleUwW0KGktcs+tGgjji0yVoMnVKgsaBlF2kdCyIXDvfduH8xl z6cGy4AROaCut1lD7+IMBMfEVuvdLqhU06Pk2HGzRJikEyJ96OKHQDhADxC4QDtb 8aYcXa+jDdiVfP9fY+vlSzNUmacR8TNCXLRHeTZymJyKPI9oJTz4adH/w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddukedgfeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuff fkofgjfhgggfestdekredtredttdenucfhrhhomhepfdflrdcuffgvkhhkvghrfdcuoehj uggvkhesihhtrghnihhmuhhlrdhliheqnecuggftrfgrthhtvghrnhepgedvhfffudduge ehveeikeeifeefgfevffektdehkeeifefhveeuteeufefhteetnecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhguvghksehithgrnhhimhhulh drlhhipdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthho pehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 21 Aug 2024 07:18:37 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Wed, 21 Aug 2024 13:18:31 +0200 Message-ID: <20240821111834.81752-2-jdek@itanimul.li> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240821111834.81752-1-jdek@itanimul.li> References: <20240821111834.81752-1-jdek@itanimul.li> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/4] checkasm: print only results to stdout 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: Ynj2XXTJR7lP Signed-off-by: J. Dekker --- tests/checkasm/checkasm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index d9b5c94faa..c5c1eeb07a 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -775,7 +775,7 @@ static int bench_init_linux(void) #endif }; - printf("benchmarking with Linux Perf Monitoring API\n"); + fprintf(stderr, "benchmarking with Linux Perf Monitoring API\n"); state.sysfd = syscall(__NR_perf_event_open, &attr, 0, -1, -1, 0); if (state.sysfd == -1) { @@ -802,7 +802,7 @@ static int bench_init_ffmpeg(void) fprintf(stderr, "checkasm: unable to execute platform specific timer\n"); return -1; } - printf("benchmarking with native FFmpeg timers\n"); + fprintf(stderr, "benchmarking with native FFmpeg timers\n"); return 0; #else fprintf(stderr, "checkasm: --bench is not supported on your system\n"); @@ -824,7 +824,7 @@ static int bench_init(void) return ret; state.nop_time = measure_nop_time(); - printf("nop: %d.%d\n", state.nop_time/10, state.nop_time%10); + fprintf(stderr, "nop: %d.%d\n", state.nop_time/10, state.nop_time%10); return 0; } From patchwork Wed Aug 21 11:18:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 51100 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:4062:b0:48e:c0f8:d0de with SMTP id kz34csp357870vqb; Wed, 21 Aug 2024 04:26:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWEh7p2COUi5jpQIJCKV2OevrzKPdlQiIrXFYaUkeRsdurMtrSf8KWrv0XXsQj+NEECvoF7lAhetK9UJZ6Bo4Cc@gmail.com X-Google-Smtp-Source: AGHT+IFyrMVZEfqCr1tzuez3pT8bg1Ba3DxadYOGnGN1npP2YY2+OLYH8A5DBhqaXPqwWTrdB23D X-Received: by 2002:a17:907:d2e7:b0:a7a:ce2b:d7c7 with SMTP id a640c23a62f3a-a866f8c4598mr159761866b.53.1724239580613; Wed, 21 Aug 2024 04:26:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724239580; cv=none; d=google.com; s=arc-20160816; b=hEwUZjHewmEaZgn48gt2mRiaIkHqQiTXj2Rk6ZZhUK1uZohkU59KzrVl1tfnaT8RGy da8KPESGYB2xnQ388fyTdGLKKbv0FVG59Z2Oe/JUMWBRcZhoT9CMDU9ftiIMWpGO+F++ /phiazGgd0LdDn2LlivPOR4lbXJHs1FPVg9ADg+A30n5xvYMKwtzjvesm1PFiLANJ7tK k7mNl75PQPuR/oVy5liesD+IqXWD6Nl0/WNYSwPcFyH+S1fUkLNT7yuRiLqGOOdbQoOm 8Tx2jCYaPul6/wGOc6Wt1Y6x3UmES8XHtVGuJdSyYdQNmSISorlIC4NwRokjtJqpB+qk taLQ== 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:feedback-id:dkim-signature:dkim-signature:delivered-to; bh=Tq7XuzxXJLqMVm4Ufbo8kzbJrGSnBIYA3ern59GsiRo=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=X3s4rkkZTX47s2DxTHKKZ8rQJhwAUfQi6vdZhWI9pLfRUwIRyN4T8omGHq5FXkqfyd EaTtPg+vgWqthFCWJz24BrirggBpRlw4AnXzQqDtYc4Q2pkwYhVX4IxhhmDVSiXlubLg yf4H/cpt1gjeeW4DanTvdUn+HvKqm087j2OFcqHka+k07vafCClx9iIK4I17R2EOjyk9 zHlBbFO9FG4yNy398GsGTlTd83FXW3zUhX5OxRnVGUEc7YIt+5hD0k6LUb9/JPQJ/ZjE TjytBymkbqfui9VhgYGd2NW6nxqIyEBIJFT2ghVsipEIHODDooE4iczKmCTxawo8jT1f WpLA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm2 header.b=srYaRCz1; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm1 header.b=r3Cc6UvT; 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 a640c23a62f3a-a867aecda73si65530766b.317.2024.08.21.04.26.19; Wed, 21 Aug 2024 04:26:20 -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; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm2 header.b=srYaRCz1; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm1 header.b=r3Cc6UvT; 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 4985D68DBD8; Wed, 21 Aug 2024 14:18:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from fout2-smtp.messagingengine.com (fout2-smtp.messagingengine.com [103.168.172.145]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0554768DBD4 for ; Wed, 21 Aug 2024 14:18:42 +0300 (EEST) Received: from phl-compute-04.internal (phl-compute-04.nyi.internal [10.202.2.44]) by mailfout.nyi.internal (Postfix) with ESMTP id E6C4D138FFAA for ; Wed, 21 Aug 2024 07:18:39 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Wed, 21 Aug 2024 07:18:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itanimul.li; h= cc:content-transfer-encoding:content-type: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=1724239119; x=1724325519; bh=VNHdvmre4PcaGOshO7e3BWUmkV1Kni+KDTqqr9AbRLw=; b= srYaRCz1cyFhW7opyX1naUDakneWg4+hZ15aEFO5UmnNdQsE2wXQE/zoqD6fqbit h/mONHdjCpeFmyiIQk0vl4mRaJ6CQxx8AJ30Rj+1jIlvwNMvY8uuX9aIxvqvDJ3g K+vECBpja4l55kBBGeDZXq0Ee7j3UlOBpui9gBXLCoTLUtBmPNfgHEHb8dAq2JN8 td+rFpowTxnk3PCrWVRxolPjtar3Sg0SNUZMY1i7Z/gtKHGqJI1RHjRGD3M90mws 6Vc80CQjmvrwWUBk/e/MIFktn0JfRc2AcsUOgbQ45faVItTyP4E43GUBbaPowLa4 o2weiIKbZoKaWOtNBE+CmA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :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=1724239119; x= 1724325519; bh=VNHdvmre4PcaGOshO7e3BWUmkV1Kni+KDTqqr9AbRLw=; b=r 3Cc6UvTB9Uk0fFGT4Py4kFWqNn/RefdzspdoqsL+pelMu7cACgG5O4wIltQXYRQx Twul1dUacFemHZcG+uxkbyXfOA0jpQbgkAtXE5iBsbMn04AGDK7p5rdOm/JrGNfG 9Pubgf2mBmvWv+dn/bcN5j5pcMlE2SB/gzPqcyQuIeJ4JUj9/0zlU0Ckukrme+wa NX2w49jbo/SiPR2DrZ3vUsJRfZlM2ThQwUhVwKBFHjh4mrfarWq3obYd+BKvU98A eDI8F2lpQDfQvHDfxzNjnWQmLutnwtzgV2jXYv0aLfP/jwfwDlKgJuHlS1KvLLT/ pcqyWcH0Pvzss2gt2+TJQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddukedgfeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuff fkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpedflfdrucffvghkkhgvrhdfuceo jhguvghksehithgrnhhimhhulhdrlhhiqeenucggtffrrghtthgvrhhnpeekvedvudevfe eufffhffeluedvgeefgedtgefhhffhtdevudegfeekffffieetgfenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjuggvkhesihhtrghnihhmuh hlrdhlihdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthht ohepfhhfmhhpvghgqdguvghvvghlsehffhhmphgvghdrohhrgh X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 21 Aug 2024 07:18:39 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Wed, 21 Aug 2024 13:18:32 +0200 Message-ID: <20240821111834.81752-3-jdek@itanimul.li> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240821111834.81752-1-jdek@itanimul.li> References: <20240821111834.81752-1-jdek@itanimul.li> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 3/4] checkasm: improve print format 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: FDIlTM97Pc6v Port dav1d's checkasm output format to FFmpeg's checkasm, includes relative speedups and aligns results. Signed-off-by: J. Dekker --- tests/checkasm/checkasm.c | 53 +++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index c5c1eeb07a..f43c1c50f0 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -18,6 +18,31 @@ * You should have received a copy of the GNU General Public License along * with FFmpeg; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright © 2018, VideoLAN and dav1d authors + * Copyright © 2018, Two Orioles, LLC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" @@ -575,6 +600,16 @@ static int measure_nop_time(void) return nop_sum / 500; } +static inline double avg_cycles_per_call(const CheckasmPerf *const p) +{ + if (p->iterations) { + const double cycles = (double)(10 * p->cycles) / p->iterations - state.nop_time; + if (cycles > 0.0) + return cycles / 4.0; /* 4 calls per iteration */ + } + return 0.0; +} + /* Print benchmark results */ static void print_benchs(CheckasmFunc *f) { @@ -584,17 +619,25 @@ static void print_benchs(CheckasmFunc *f) /* Only print functions with at least one assembly version */ if (f->versions.cpu || f->versions.next) { CheckasmFuncVersion *v = &f->versions; + const CheckasmPerf *p = &v->perf; + const double baseline = avg_cycles_per_call(p); + double decicycles; do { - CheckasmPerf *p = &v->perf; if (p->iterations) { - int decicycles = (10*p->cycles/p->iterations - state.nop_time) / 4; + p = &v->perf; + decicycles = avg_cycles_per_call(p); if (state.csv || state.tsv) { const char sep = state.csv ? ',' : '\t'; - printf("%s%c%s%c%d.%d\n", f->name, sep, + printf("%s%c%s%c%.1f\n", f->name, sep, cpu_suffix(v->cpu), sep, - decicycles / 10, decicycles % 10); + decicycles / 10.0); } else { - printf("%s_%s: %d.%d\n", f->name, cpu_suffix(v->cpu), decicycles/10, decicycles%10); + const int pad_length = 10 + 50 - + printf("%s_%s:", f->name, cpu_suffix(v->cpu)); + const double ratio = decicycles ? + baseline / decicycles : 0.0; + printf("%*.1f (%5.2fx)\n", FFMAX(pad_length, 0), + decicycles / 10.0, ratio); } } } while ((v = v->next)); From patchwork Wed Aug 21 11:18:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 51098 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:4062:b0:48e:c0f8:d0de with SMTP id kz34csp354226vqb; Wed, 21 Aug 2024 04:19:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWrO3lnIz/QPZF362x7FLtVQAG5WCXHABJ3oUogE25dRAluXdNAc5uT5R+/lYwesNsRwcqBjin/Q2kB3ar/UuY1@gmail.com X-Google-Smtp-Source: AGHT+IF1S3q3APuoOMqsHa4DK5h4qstcIVa8vcEIvAoR171NkKsFadAd5ZFhNd/Y66x8+ST87Xlq X-Received: by 2002:a17:907:1b1f:b0:a80:f54c:ad68 with SMTP id a640c23a62f3a-a866f134d91mr86811066b.2.1724239158958; Wed, 21 Aug 2024 04:19:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724239158; cv=none; d=google.com; s=arc-20160816; b=ePnmUCAahuqfpEu9BQFqqSnfi2Kb5uP0QZOzry/UkCyUnLNIQmJOu1coWRRwxOfPHn OmLxTHZ7pylmHQyw+6sVfG1qHQSk+Hr9HWtQdfvDLBF0EigGJQbjDBwGjjgNf4Y8Va26 4OAPwD1HMZVcx+PzqPX0fQm0beKN2ETFMk010jOGnfFvjDUpAbHAQmbdfs3Q7bu4GciU OQUNWT9Pzd4k8kNz91mA5QvyDZWRQ6+SQbb5mO1EEmKLqwL0t8Y+4olSr4wfJMdFYxYG X2O55roO4XDzQbJwD02JjEWaoEbiixbt3K43Wv78tvFRiTwC4fzczIRREYCilrAHUOrK Fhjg== 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:feedback-id:dkim-signature:dkim-signature:delivered-to; bh=RJQjz1/b1CbFlBaUuSzjpDCiT4MMH+yPb8lwaj2geIY=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=gE4tw7C95uRw/DPZPHa5hbAugWIgftsG+D/Y7aIcDcL6xE8Z3KkOtDvMVoAqeS0Bdk DiWoG1pmmCuoNNSD+MTfSm0iNsY1mzWolJo1wYIus/Cp8JlElAb4oKLFC4OtHjdA16rc vTFv5KHNnoDBK+DvdeOM+iMp7UKUlfCPGIAjgprWYE/XuXVEzCepUM0WYB1xoO02oPNK +31oRw1y7epBqoBQLIMXNm5tMr/24m9E4Ed8FpJyUQhHZzkUeGW+nEgXgW7ldJx+8/KV 7U0BlBcfbfFnAS3RnGzuRe0JB87rsAPFDCv0+iyvvJByCUxIy34b1SNTZxrQRApbsfNa KWLw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm2 header.b="Q/WaVriu"; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm1 header.b=pPRo0Hx6; 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 a640c23a62f3a-a838398dde3si824171866b.1019.2024.08.21.04.19.18; Wed, 21 Aug 2024 04:19: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; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm2 header.b="Q/WaVriu"; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm1 header.b=pPRo0Hx6; 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 A22AC68DBE6; Wed, 21 Aug 2024 14:18:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from fout2-smtp.messagingengine.com (fout2-smtp.messagingengine.com [103.168.172.145]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 92E0E68DBD6 for ; Wed, 21 Aug 2024 14:18:42 +0300 (EEST) Received: from phl-compute-08.internal (phl-compute-08.nyi.internal [10.202.2.48]) by mailfout.nyi.internal (Postfix) with ESMTP id 7EB87138FFAE for ; Wed, 21 Aug 2024 07:18:41 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Wed, 21 Aug 2024 07:18:41 -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=1724239121; x= 1724325521; bh=SQHveTENdbpG99r1uM5w1O2TJYS/X60jzfR4eJJHX7k=; b=Q /WaVriu+zU0I+0981rgPGlsmRkp8u/WokM1SYJ2dq2QsXBMAa4gmd6ctxtmvd7Np 4CZYAZrqk86YXHGV86QFB5gjMxRte2Ssi+GPFR8/ospEH/VxmEZJeFDVwYvDzZkF AkJdGMSmcFfvBT38tM8UoaG8viQAG7D3tZ2z0cp+uMvUmsxVYtnkp4RHo3kzbv/J RIDLbZfbBW+cC156BdNTgltzoETRIhdhkbTvEwGr0JhIeutp/k7gEkjBggwz5mQv mQwB455udObCgBO2MFV1WaZP6fcmIouR6f6/2svgd+zFbHI7DtcFJYnw4XhzRJ4A XAtZkUClFswGTRep/8kuA== 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=1724239121; x=1724325521; bh=SQHveTENdbpG9 9r1uM5w1O2TJYS/X60jzfR4eJJHX7k=; b=pPRo0Hx6prZgm2qL3YHxOpzqY0ype DEfIoXfufCW5LwprG15fIARJ8li7xDVOKMLqXCCMznglGSfZErt0LTP24GEAOUDh 1WuXWaTFF/vvCF+pUQWinng1KndwJcboIDIFH5x5h+XuAAAZJEAxu1Dro6TdkjlC QsV22JvAsUqBuM4TvRRX1mv/6lWl5XUu/Sa9vizHYw/KAdXMBfHBV0PRfQtdkqLS 6ngg4VPJ8tbOvNhwDheTuq82PFG2vSSS4cbSmP84wmY4pKSnX5+4x+62CAFHYMzZ GnCddaIEfFvZL2t78Fl/qZvRHXzdXNXR3oqOMkT0LUSogekROfznfihuQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddukedggedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuff fkofgjfhgggfestdekredtredttdenucfhrhhomhepfdflrdcuffgvkhhkvghrfdcuoehj uggvkhesihhtrghnihhmuhhlrdhliheqnecuggftrfgrthhtvghrnhepgedvhfffudduge ehveeikeeifeefgfevffektdehkeeifefhveeuteeufefhteetnecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhguvghksehithgrnhhimhhulh drlhhipdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthho pehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 21 Aug 2024 07:18:40 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Wed, 21 Aug 2024 13:18:33 +0200 Message-ID: <20240821111834.81752-4-jdek@itanimul.li> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240821111834.81752-1-jdek@itanimul.li> References: <20240821111834.81752-1-jdek@itanimul.li> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 4/4] checkasm: add wildcompares for test & 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: xTlhmzEH8yTg Added: --test= Filter tests by glob style pattern. --bench[=] Run benchmark and optionally filter functions by glob style pattern. Example: $ ./tests/checkasm/checkasm --bench=yuva* [...] yuva420p_bgr24_8_c: 34.5 ( 1.00x) yuva420p_bgr24_8_ssse3: 31.1 ( 1.11x) yuva420p_bgr24_128_c: 310.6 ( 1.00x) yuva420p_bgr24_128_ssse3: 178.1 ( 1.74x) yuva420p_bgr24_1080_c: 2509.6 ( 1.00x) yuva420p_bgr24_1080_ssse3: 1471.5 ( 1.71x) yuva420p_bgr24_1920_c: 4462.6 ( 1.00x) yuva420p_bgr24_1920_ssse3: 2331.1 ( 1.91x) [...] Ported from dav1d. Signed-off-by: J. Dekker --- tests/checkasm/checkasm.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index f43c1c50f0..99f6ab5f76 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -385,7 +385,7 @@ static struct { int cpu_flag; const char *cpu_flag_name; - const char *test_name; + const char *test_pattern; int verbose; int csv; int tsv; @@ -771,6 +771,22 @@ static void signal_handler(int s) { } #endif +/* Compares a string with a wildcard pattern. */ +static int wildstrcmp(const char *str, const char *pattern) +{ + const char *wild = strchr(pattern, '*'); + if (wild) { + const size_t len = wild - pattern; + if (strncmp(str, pattern, len)) return 1; + while (*++wild == '*'); + if (!*wild) return 0; + str += len; + while (*str && wildstrcmp(str, wild)) str++; + return !*str; + } + return strcmp(str, pattern); +} + /* Perform tests and benchmarks for the specified cpu flag if supported by the host */ static void check_cpu_flag(const char *name, int flag) { @@ -786,7 +802,7 @@ static void check_cpu_flag(const char *name, int flag) state.cpu_flag_name = name; for (i = 0; tests[i].func; i++) { - if (state.test_name && strcmp(tests[i].name, state.test_name)) + if (state.test_pattern && wildstrcmp(tests[i].name, state.test_pattern)) continue; state.current_test_name = tests[i].name; tests[i].func(); @@ -931,9 +947,9 @@ int main(int argc, char *argv[]) state.bench_pattern = arg + 8; state.bench_pattern_len = strlen(state.bench_pattern); } else - state.bench_pattern = ""; + state.bench_pattern = "*"; } else if (!strncmp(arg, "--test=", 7)) { - state.test_name = arg + 7; + state.test_pattern = arg + 7; } else if (!strcmp(arg, "--csv")) { state.csv = 1; state.tsv = 0; } else if (!strcmp(arg, "--tsv")) { @@ -1037,7 +1053,7 @@ void *checkasm_check_func(void *func, const char *name, ...) int checkasm_bench_func(void) { return !state.num_failed && state.bench_pattern && - !strncmp(state.current_func->name, state.bench_pattern, state.bench_pattern_len); + !wildstrcmp(state.current_func->name, state.bench_pattern); } /* Indicate that the current test has failed */