From patchwork Wed Sep 26 18:37:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 147637 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1071377lji; Wed, 26 Sep 2018 11:43:04 -0700 (PDT) X-Google-Smtp-Source: ACcGV60d3YiN64afsdEOz/eRfwFB4YjKRE6H4F4qIrB6B3j8DwU4EhcLV1L8O7Qq511jzXa2IaLz X-Received: by 2002:ae9:ebce:: with SMTP id b197-v6mr2220266qkg.169.1537987384169; Wed, 26 Sep 2018 11:43:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537987384; cv=none; d=google.com; s=arc-20160816; b=NN2FcK7xo3FLpPp0G7xbBqtHfNFEEjVnM/LZmTbHqxe01/ruwsnuas9AgHDLAZO1K5 pk82CulQMm4WGxG6KobLN0IWKKJNleopUtIfiPuy0hoHLJwP9E9AEipNIsh+Ryb2BuYz KPs1IFQRepy2tTYMFdHFd+hm0ijYB6CqIRuC+63AAmtQEnk4SpYZkfnxvJywqMmbskHf ts20RztRoU4e2rZP9pxiydAF6x3d+jCC/NuqQPpXYakiq9Dx97TzktC4bYqtasimNNZi S0wE/lj5Q8GDbyQazs0v9AGcSDwlFebb0jK3foAUxUOdpngZlFr71DSf+nEhvqJXdxlf s2WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=ebrH3/WC1cnAKldKn/Zvg23FIfD9KDexrgYk70Bbezs=; b=HTDhu7rErnPBdb5xNMpothnjxqo9a5U96IKNNtHFpPEbRKIvfqWTv0ambD2TAo1G+d QH86G7Ae2CTTBIx0yJ8Yj91Z6D+ev0lW1pkUCobkYYt5OVI4WBL7AELf6Pc8A37xw7wm OPf9ecu3bTtTly+uvgMvISQdSTrORU79zwvg73eUrtVRW8uktBYQGcycTg8Ks0jyBmoN nctd8iip6xWtZDiYMybtUT9cwASjQFcunxsE7Fdvy+EE8S1ImrGjVszPiz5OnyWWG6R8 ZC7BnHV91qSLbsjpyvf9DZAYLmfqLf//AY0DeoxQHUKOK8I4E9jyyFfLHtExW71cf5I/ APiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JI4lMkFv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id y49-v6si5111439qtj.67.2018.09.26.11.43.04 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 26 Sep 2018 11:43:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JI4lMkFv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60192 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Em7-00085u-Hc for patch@linaro.org; Wed, 26 Sep 2018 14:43:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Egm-0001b3-Eg for qemu-devel@nongnu.org; Wed, 26 Sep 2018 14:37:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5Egj-0007O3-0s for qemu-devel@nongnu.org; Wed, 26 Sep 2018 14:37:32 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:38085) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5Egf-0007H3-B8 for qemu-devel@nongnu.org; Wed, 26 Sep 2018 14:37:26 -0400 Received: by mail-pf1-x432.google.com with SMTP id x17-v6so13885368pfh.5 for ; Wed, 26 Sep 2018 11:37:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ebrH3/WC1cnAKldKn/Zvg23FIfD9KDexrgYk70Bbezs=; b=JI4lMkFvJ+HDRmoymUuA/sPQySJy9X9UKG9c6cQwOyhmLGZs0/k8B+FiQh6DrdwKx9 1/fVAwKPT+IVRzM0DP8HsUshxXIB7f8KlDqZej0+zRkZ0/3nhRkpRFraOnf2CKxaZOuN CSFidrwDkA0SDbX8IntZ4xOvtDoRQUyTJe/3I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ebrH3/WC1cnAKldKn/Zvg23FIfD9KDexrgYk70Bbezs=; b=ObMzaHpHTMZYaCKa2+fE8OLmSIt9RBHfce3FJVfbiZ6r262vb2EyCv5v1FIUkbDlay spPbsAiFJTR8cvFlcFMOx0vMySKEUmtV5df8MCOBr8ygJMOwoZu8qpJj7ZgfkPQuGDSa i5Ln7SasMl6gmFpAQLTJFWg3MrCrb5r0Lmzsga2iHfJzFfguIJo0QTjN46BxKygscb42 ZLlZnwkrjyhxAo2QRn3+Xuo5KShTPFp9I9gXeD9MhyQce2uOc7saU9cAI/zsysjsCCSm g6sx5acLetVus0ddRb9aK9mLDqDaPSF74GG+TMSGbnoZ+/dcPAVHdiJfPP2uPeC2rwKh 4Uhw== X-Gm-Message-State: ABuFfogL8g06RBoPA3tqgXmQ5qxL9FIEtC3MWNZilZVxRQv3tjEiKkuX ZtFH1dO263G9CWyEADq7+6RGg8Xo6fM= X-Received: by 2002:a63:5558:: with SMTP id f24-v6mr6883346pgm.37.1537987041284; Wed, 26 Sep 2018 11:37:21 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id b14-v6sm9735952pfc.178.2018.09.26.11.37.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Sep 2018 11:37:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 26 Sep 2018 11:37:02 -0700 Message-Id: <20180926183709.21293-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180926183709.21293-1-richard.henderson@linaro.org> References: <20180926183709.21293-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::432 Subject: [Qemu-devel] [PULL 06/13] test-qht: speed up + test qht_resize X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, "Emilio G. Cota" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Perform first the tests that exercise code paths that are easier to hit at small table sizes, and then resize the table to speed up subsequent tests. If this resize is not too large, we can make the test faster with no code coverage loss. - With gcov enabled: Before: 20.568s, 90.28% qht.c coverage After: 5.168s, 93.06% qht.c coverage The coverage increase is entirely due to calling qht_resize, which we weren't calling before. Note that the code paths that remain to be tested are either error handling or can only occur when several threads are accessing the hash table concurrently (e.g. seqlock retry, trylock fail). - Without gcov: Before: 1.987s After: 0.528s The speedup is almost the same as with gcov, although the "before" run is a lot faster. Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Richard Henderson --- tests/test-qht.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.17.1 diff --git a/tests/test-qht.c b/tests/test-qht.c index 77666e8c5f..1ec039d636 100644 --- a/tests/test-qht.c +++ b/tests/test-qht.c @@ -189,6 +189,10 @@ static void qht_do_test(unsigned int mode, size_t init_entries) rm_nonexist(7, 8); iter_rm_mod(1); + if (!(mode & QHT_MODE_AUTO_RESIZE)) { + qht_resize(&ht, init_entries * 4 + 4); + } + check_n(0); rm_nonexist(0, 10); insert(0, N);