From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 0PT/A5+KhWBQ9AAAgWs5BA (envelope-from ) for ; Sun, 25 Apr 2021 17:28:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id +IBaO56KhWCrLAAA1q6Kng (envelope-from ) for ; Sun, 25 Apr 2021 15:28:30 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7B7D1162C4 for ; Sun, 25 Apr 2021 17:28:29 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 5A53126ACD; Sun, 25 Apr 2021 11:28:25 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id CBF9D26874 for ; Sun, 25 Apr 2021 11:28:21 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 2B2C85FF53; Sun, 25 Apr 2021 11:28:20 -0400 (EDT) Received: (nullmailer pid 2501284 invoked by uid 1000); Sun, 25 Apr 2021 15:28:18 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH] perf-test: add option to run perf Date: Sun, 25 Apr 2021 12:28:16 -0300 Message-Id: <20210425152816.2501198-1-david@tethera.net> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Message-ID-Hash: IQCMEQO7IOH5UR5KFRIDQCBM55UOLOWV X-Message-ID-Hash: IQCMEQO7IOH5UR5KFRIDQCBM55UOLOWV X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1619364509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=dK2apjOsc5H+OlnLJw/1zspHOPI7paPngvHTDgB2W0c=; b=qaNYE6qXsBuMnwE/JsBoA0UM4qzRRyS9AxXyn10YPkxaP42R2Tms+RXVXk2IjDNtVxBlNF oSV+WVAX7E2zAe/9mc5eIEEGXFiFKjDN4f9WmOGWnLd3Z70jPVZt1LFnYHsCm2JMI9I3yZ EkXo6Vefy+y2KCcGebu2SY1Xvqgag1MezihuYFogjvxeP5QySg6jCuAyl3Aa1qLUy7hKCH UYEvwF1PssdY/O3Xmz/oRL2n0oyYMMlUGJHYC/VBgB9rUy02Y61KuyBtJe6U0/eGiphO05 sJHS56Eql9CU71Ic7fw5Xbm19B9D1cntDW44zRv1o3zItIJCPIGlN+OI2WoY/Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619364509; a=rsa-sha256; cv=none; b=tFnf/d11ZndJF4NxuFy6bhX5xs0T0GZbqaBjBTbGaze6E8oJ96P9VU9/0oWmfOETNC+Te/ XmZEnRvq69oNqZLEGhAbMCrPPniVtK07JKTPLX3SjCro7fbqapNHhkK166u6EhK9eF39w1 LDhul2MT7U+igrA8uFBcNI8lj1Ll4aEt9qkJZWQpdu7lOl1ZYQyQ9QsDAvYOIEL6JqKKFa I7X2SC91h+PKgIqOxE7DFGpuiWKds5GAsoedib/Oy5AQLVDbo8/o+zWiunc11rB1HLu4Q9 lxS04aUUR3Fi3xe8zJ6TTUx8cd5v73y5gBi9x67eww3Vkl2ifElWJLysR9JMOQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.12 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 7B7D1162C4 X-Spam-Score: -1.12 X-Migadu-Scanner: scn0.migadu.com X-TUID: WUAvyUxjDOf1 Although the generation of perf data is not as slow as valgrind, it seems simplest to re-use the machinery already there to save the logs in a timestamped subdirectory. --- I'm not sure about the use of --call-graph=lbr here. On the one hand, the documentation mentions it depends on recent intel hardware. On the other hand, fp does not work for me (just gives 00000000000) and dwarf yields giant data files that take painfully long to run "perf report" on. performance-test/perf-test-lib.sh | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/performance-test/perf-test-lib.sh b/performance-test/perf-test-lib.sh index b70288cc..216d1824 100644 --- a/performance-test/perf-test-lib.sh +++ b/performance-test/perf-test-lib.sh @@ -2,6 +2,7 @@ corpus_size=large +use_perf=0 while test "$#" -ne 0 do case "$1" in @@ -9,6 +10,10 @@ do debug=t; shift ;; + -p|--perf) + use_perf=1; + shift + ;; -s|--small) corpus_size=small; shift @@ -127,10 +132,20 @@ notmuch_new_with_cache () fi } +make_log_dir () { + local timestamp=$(date +%Y%m%dT%H%M%S) + log_dir="${TEST_DIRECTORY}/log.$(basename $0)-$corpus_size-${timestamp}" + mkdir -p ${log_dir} +} + time_start () { add_email_corpus + if [[ "X$use_perf" = "X1" ]]; then + make_log_dir + fi + print_header notmuch_new_with_cache time_run @@ -140,9 +155,7 @@ memory_start () { add_email_corpus - local timestamp=$(date +%Y%m%dT%H%M%S) - log_dir="${TEST_DIRECTORY}/log.$(basename $0)-$corpus_size-${timestamp}" - mkdir -p ${log_dir} + make_log_dir notmuch_new_with_cache memory_run } @@ -193,7 +206,13 @@ time_run () printf " %-22s" "$1" test_count=$(($test_count+1)) if test "$verbose" != "t"; then exec 4>test.output 3>&4; fi - if ! eval >&3 "/usr/bin/time -f '%e\t%U\t%S\t%M\t%I/%O' $2" ; then + if [[ "X$use_perf" = "X1" ]]; then + command_str="perf record --call-graph=lbr -o ${log_dir}/${test_count}.perf $2" + else + command_str="/usr/bin/time -f '%e\t%U\t%S\t%M\t%I/%O' $2" + fi + + if ! eval >&3 "$command_str" ; then test_failure=$(($test_failure + 1)) return 1 fi -- 2.30.2