From nobody Mon Feb 9 14:59:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1592689602; cv=none; d=zohomail.com; s=zohoarc; b=jOsT8HhQfWr0dg/Em7VNrFqwgA0SVYoX4bZXpm7Vdf1viNDAEpCsY5OJ2APDaBRw9SD1wceEe6os/7WufAbRxcIVKfObLX2b8m3Qjw5uoU5a4SPNArPlrG23aBa7yyCNa7hQG0zDb9/vVzxBUvOTB4qg3j5KZj7nc4w2jnwUQIA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592689602; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=DluY8Oq2yB2PRsFlspiwVeg903l4iG/+upHvbfNm14Q=; b=jgDZQRwkDnQkvADmB2SR6eZDGMVjbN4OV9aOeZzvkIrdEotbqCsviiNS0GmfviXmoPD6z6RCigskuGxKeF3yabR3YgULGvj36DpS9HoLc+YCZy8nGkFQ7dGvaRs9sBHsVHHrj2rUJv+NJeC2ZH3s1jj1LSRWGlX597pLN2/yxW8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592689602759814.8574793259504; Sat, 20 Jun 2020 14:46:42 -0700 (PDT) Received: from localhost ([::1]:37746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jmlJw-0001Q7-Rx for importer@patchew.org; Sat, 20 Jun 2020 17:46:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jmlJF-0000Cu-M1 for qemu-devel@nongnu.org; Sat, 20 Jun 2020 17:45:57 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:34206) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jmlJD-0007oo-Qh for qemu-devel@nongnu.org; Sat, 20 Jun 2020 17:45:57 -0400 Received: by mail-pl1-x643.google.com with SMTP id n9so5675076plk.1 for ; Sat, 20 Jun 2020 14:45:54 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id q1sm10087959pfk.132.2020.06.20.14.45.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Jun 2020 14:45:52 -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:mime-version :content-transfer-encoding; bh=DluY8Oq2yB2PRsFlspiwVeg903l4iG/+upHvbfNm14Q=; b=MOAvclSRYtWG3W0USsiKFVXWL80r3LkxmeG6Xdlr7QkqgvfernjisV9qSwNO9sO5Qp m70fMHU6I8zFxrcEeyHK60wTw9W3ecsZoNOBRIT4wQu4tOV1EDHQf65fdddRecE063pu o/PT2QNsh+9jRc1kmPI0fHxX/NMB8uSOxd1iaaF3YBKnkHZ5S4l9nfRK+znhr2MG+nR4 XWZboUmxfJRPY5MBKRQjfLVqHUDmVHd6N6VHlFMHVou3An7Cu/rzikaqwROXN2PCAGBj bJvqfOMk3abzUvR0DLSSmd6+TZuxZxawl2CxvAcFwIHqlq4hilR+f9HqDJ1vK6d0S8lO 6VIQ== 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:mime-version :content-transfer-encoding; bh=DluY8Oq2yB2PRsFlspiwVeg903l4iG/+upHvbfNm14Q=; b=GItML1FhkZMqvz+y6RdQApUKqukpBDRvgBh435HmhsJ8UXyY86/Fi3D9x53DimVSQ/ xXBQjd+YcpoirnWG+HFLi1MvfYk4D0h4Q4P3cTp/dPr79mkZMtwnREJgrirq8ilXKq08 l06KKdrCLuJrRle3YrxBC5kKIEeCfYDAoujOQ4wSvNucGHPcjYuKbcKrSIHpEqbO0OBq f+aOmyhZGf1A48Ky4DnXHUvI4VuNWA47Kb+D7VkrgnH8q/su2X4D7LDLFq4vxPkhLQdS 8PyBXbHRxgXjfIWsZ+7YmxY5Sqcinb9L9cRqOTryvfowfsaWYqc1svChwCafd43jezJR sG9Q== X-Gm-Message-State: AOAM531+XngAIqxCAimn3uk/7032MKC4vjqc3fRJk81qfI0FN9YwelAS ixOMC6gvdS7MwMGvj0gRii8ytFbnJHQ= X-Google-Smtp-Source: ABdhPJyseIoIh44J1TsyVrRZGVQb3F39FXoNNpEWkg3qCtK2G8HLgJC6Z+f0/rIbEnCTWqcfbC82yA== X-Received: by 2002:a17:902:ed02:: with SMTP id b2mr13854700pld.326.1592689553448; Sat, 20 Jun 2020 14:45:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH] tests/qht-bench: Adjust rate computation and comparisons Date: Sat, 20 Jun 2020 14:45:51 -0700 Message-Id: <20200620214551.447392-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::643; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x643.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, "Emilio G . Cota" , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Use <=3D comparisons vs the threshold, so that threshold UINT64_MAX is always true, corresponding to rate 1.0 being unity. Simplify do_threshold scaling to 2**64, with a special case for 1.0. Cc: Emilio G. Cota Signed-off-by: Richard Henderson --- tests/qht-bench.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/qht-bench.c b/tests/qht-bench.c index eb88a90137..21b1b7de82 100644 --- a/tests/qht-bench.c +++ b/tests/qht-bench.c @@ -132,7 +132,7 @@ static void do_rz(struct thread_info *info) { struct thread_stats *stats =3D &info->stats; =20 - if (info->r < resize_threshold) { + if (info->r <=3D resize_threshold) { size_t size =3D info->resize_down ? resize_min : resize_max; bool resized; =20 @@ -154,7 +154,7 @@ static void do_rw(struct thread_info *info) uint32_t hash; long *p; =20 - if (info->r >=3D update_threshold) { + if (info->r > update_threshold) { bool read; =20 p =3D &keys[info->r & (lookup_range - 1)]; @@ -281,11 +281,18 @@ static void pr_params(void) =20 static void do_threshold(double rate, uint64_t *threshold) { + /* + * For 0 <=3D rate <=3D 1, scale to fit in a uint64_t. + * + * For rate =3D=3D 1, returning UINT64_MAX means 100% certainty: all + * uint64_t will match using <=3D. The largest representable value + * for rate less than 1 is 0.999999999999999889; scaling that + * by 2**64 results in 0xfffffffffffff800. + */ if (rate =3D=3D 1.0) { *threshold =3D UINT64_MAX; } else { - *threshold =3D (rate * 0xffff000000000000ull) - + (rate * 0x0000ffffffffffffull); + *threshold =3D rate * 0x1p64; } } =20 --=20 2.25.1