Received: by 10.223.185.116 with SMTP id b49csp2371381wrg; Thu, 15 Feb 2018 10:33:42 -0800 (PST) X-Google-Smtp-Source: AH8x224HRtAqxPqodbBF1FX8JhArXk4iyJA12HeFq8hpVVd6n8PLuM7tECKO4CALQcelArTo3yvb X-Received: by 10.99.112.73 with SMTP id a9mr764922pgn.253.1518719622546; Thu, 15 Feb 2018 10:33:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518719622; cv=none; d=google.com; s=arc-20160816; b=bGwhu4wD5ucBXUPGCQJ2vJjlhIWBF/53lKYNv0+au+eME0i1lac7TxMYqBA2rRAS/M P9o5IU7w2yU2E5/KY9Z8iVie0EcZs0o8w0y5VBNeQRNnS8o+g7G+qU/lllfBht+d44+U c4DZKVwxrfu1RLzO8njxTAOQBJH6mbskhhvFkXHSAhLPuGRxBBrKqnJDe7X2l1/ZphN/ 5Y2BlOF/9dYCPnAn5lyisQQW1aKR19Of6bU8XBrhsL3oLi5izBQYvxBbhRaEavNb93+d PBGVGlfPIQbMxh5rekMXGV3YG/jSzX2qoWGmZ2ELfb3Uan8P29HAL4lrwN/KgmnE8PGD 2onw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=CJODQEmQrytJ9x/+pTcEa/wA1tWq9FFUc4D/6REa7RQ=; b=YxrUg/buHXxFFcJ2oTP6j7bwRjhQi8X9jzKI+9OiHANHqRgsYKiTswyFhawiZU8s+l 1ubUyrSqvYg3OH09h1IdNEj4aeQBYrz932eyf7LJj/Oxzy3XR792VmAz4VZbxj3Loy2v zi1r7XRN969RzQTXR4lryGVtavk2dk4KxvH1X92bLuhNSVT1o9J4bI3DgezyNuFsF1IW SKWqh35qtH5xDuAqLJ1Gpk9XG3iewrkehNi3ClXGSvGg4cPwq2XqCHszZbcTt8TwX9s5 Q7kGkLJ7aXFY9ec/hSVsIig0bn9UzerHQDMyTlgAGzt3D5v0x/yeTliCm/wbB8Rlv8AF 1I2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s65si2007241pfe.45.2018.02.15.10.33.27; Thu, 15 Feb 2018 10:33:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1166578AbeBOSc1 (ORCPT + 99 others); Thu, 15 Feb 2018 13:32:27 -0500 Received: from mail-ot0-f175.google.com ([74.125.82.175]:45751 "EHLO mail-ot0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1166435AbeBOScZ (ORCPT ); Thu, 15 Feb 2018 13:32:25 -0500 Received: by mail-ot0-f175.google.com with SMTP id m15so566609otf.12 for ; Thu, 15 Feb 2018 10:32:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=CJODQEmQrytJ9x/+pTcEa/wA1tWq9FFUc4D/6REa7RQ=; b=FPr3FlblF5+EeBAY2UZkiRGKXATcDf8PpSZzlwyMTqVnjA8fpY221eHxQNOgJuqXer RtQMdwzZ5gUS1ljpOOOa84lWNksYauO28EyWfz+RvS5SYN+dlUSN+/u+cHpTJCTYsCJW bQojEKnxRaNGnteMQ5KH3fTjgY9oCEgcokeLC1YIg0If1Uwa9GvTV4D3DyV7OsTzFQFS /1g17GLDESMQv/UDlqTwyR+gsJHNBCkaYyhhs/wZS2vHlNwvvAVUR0WcFTEyQQHSgScE xhE07N+r0p7c34v/GcmcdFkhVifKv+OZk4QEQL6+Lf9BJ4w4S5vVPFPVX65PcyL3JRlQ wJ+Q== X-Gm-Message-State: APf1xPA4wgGeF03Unah1lFIvZGo3Zev+/Pa8/G0JeVrNk5F8b2WUf7fd v+VaWVZCMKmo+ljVY/gCek9dro5aexs= X-Received: by 10.157.5.3 with SMTP id 3mr2400389otw.79.1518719544177; Thu, 15 Feb 2018 10:32:24 -0800 (PST) Received: from ?IPv6:2601:602:9802:a8dc::f21a? ([2601:602:9802:a8dc::f21a]) by smtp.gmail.com with ESMTPSA id n19sm8555172ota.73.2018.02.15.10.32.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2018 10:32:22 -0800 (PST) Subject: Re: collecting simple benchmark scripts? To: Kees Cook , Shuah Khan , Fengguang Wu , Tycho Andersen , Steven Rostedt , Kevin Hilman , Thomas Gleixner , "Kirill A. Shutemov" Cc: LKML References: From: Laura Abbott Message-ID: <7723ae8d-8333-ba17-6983-a45ec8b11c54@redhat.com> Date: Thu, 15 Feb 2018 10:32:21 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/14/2018 02:50 PM, Kees Cook wrote: > Hi, > > In a separate thread, some folks were looking for some simple > benchmarks for evaluating various changes to kernel internals (as > opposed to the much more focused things like xfstests). For me, this > has been an area of lore and passed-around scripts, and it seems like > maybe we should have a subdirectory of tools/testing/benchmarks/ or > something to collect these? > > (Or maybe this already exists and I've totally missed it?) > > I've got at least one micro-benchmark in > tools/testing/selftests/seccomp/seccomp_benchmark.c, and searches show > tools/testing/selftests/vm/gup_benchmark.c too, but I was thinking of > either more generali things more like the famous "kernel build > benchmark" or a wrapper for running hackbench to get some statistics > out of it, etc. > > Or, I guess, at least collecting all the micro-benchmarks in some > single place, as they're a bit scattered. > > I'm sure I'm not remotely the first person to bring this up, but my > attempts at searches for this have failed. > > Thoughts? > > -Kees > This is the script I've been using for hackbench since it can be noisy. I expect someone to tell me the math is wrong but I'd be happy to throw this in a repo if others are interested #!/bin/sh CNT=100 mean=0.0 M2=0.0 for i in $(seq 1 $CNT); do echo $i r=`hackbench -g 20 -l 1000 | grep Time | cut -d ' ' -f 2` d_calc="$r-$mean" d=`echo $d_calc | bc -l` mean_calc="$mean+($d/$i)" mean=`echo $mean_calc | bc -l` M2_calc="$M2+($d*($r-$mean))" M2=`echo $M2_calc| bc -l` done echo "mean $mean" V_calc="$M2/$(($CNT-1))" V=`echo $V_calc | bc -l` DEV_calc="sqrt($V)" DEV=`echo $DEV_calc | bc -l` echo "variance $V" echo "stdev $DEV"