From patchwork Sat Dec 1 09:12:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Stancek X-Patchwork-Id: 1006312 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 436QX56Bz2z9s8r for ; Sat, 1 Dec 2018 20:12:53 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 9EC653E76D1 for ; Sat, 1 Dec 2018 10:12:49 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7]) by picard.linux.it (Postfix) with ESMTP id 0D7613E7698 for ; Sat, 1 Dec 2018 10:12:47 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 7B9A420149C for ; Sat, 1 Dec 2018 10:12:47 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5337830014D0; Sat, 1 Dec 2018 09:12:45 +0000 (UTC) Received: from dustball.brq.redhat.com (unknown [10.43.17.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F73268895; Sat, 1 Dec 2018 09:12:44 +0000 (UTC) From: Jan Stancek To: ltp@lists.linux.it Date: Sat, 1 Dec 2018 10:12:38 +0100 Message-Id: <3557fc1c46246a58e69ed0c5bbd39458410472a4.1543655165.git.jstancek@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Sat, 01 Dec 2018 09:12:45 +0000 (UTC) X-Virus-Scanned: clamav-milter 0.99.2 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-7.smtp.seeweb.it Cc: liwan@redhat.com, rpalethorpe@suse.com Subject: [LTP] [PATCH v2] fzsync: limit sampling time X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Fixes: #429 Sampling can take considerably longer time on single CPU and very slow systems. This patch limits sampling time to 1/2 of fuzzing runtime (0.25 of test time). If we don't have enough samples by that time, stop sampling and use stats we gathered so far. Signed-off-by: Jan Stancek Reviewed-by: Li Wang --- include/tst_fuzzy_sync.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) Changes in v2: - drop 'still sampling' warning - use exec_loop in 'stopping sampling at' message diff --git a/include/tst_fuzzy_sync.h b/include/tst_fuzzy_sync.h index 03f69b78bc82..d572461c24b6 100644 --- a/include/tst_fuzzy_sync.h +++ b/include/tst_fuzzy_sync.h @@ -162,6 +162,7 @@ struct tst_fzsync_pair { * * Defaults to 0.5 (~150 seconds with default timeout). */ + float max_sampling_p; float exec_time_p; /** Internal; The test time remaining on tst_fzsync_pair_reset() */ float exec_time_start; @@ -199,6 +200,7 @@ static void tst_fzsync_pair_init(struct tst_fzsync_pair *pair) CHK(avg_alpha, 0, 1, 0.25); CHK(min_samples, 20, INT_MAX, 1024); CHK(max_dev_ratio, 0, 1, 0.1); + CHK(max_sampling_p, 0, 1, 0.25); CHK(exec_time_p, 0, 1, 0.5); CHK(exec_loops, 20, INT_MAX, 3000000); } @@ -582,17 +584,21 @@ static inline void tst_fzsync_wait_b(struct tst_fzsync_pair *pair) static inline int tst_fzsync_run_a(struct tst_fzsync_pair *pair) { int exit = 0; + float rem_p = 1 - tst_timeout_remaining() / pair->exec_time_start; + + /* Limit amount of time spent on sampling */ + if ((pair->max_sampling_p < rem_p) + && (pair->sampling > 0)) { + tst_res(TINFO, "stopping sampling at %d samples", + pair->exec_loop); + pair->sampling = 0; + tst_fzsync_pair_info(pair); + } - if (pair->exec_time_p - < 1 - tst_timeout_remaining() / pair->exec_time_start) { + if (pair->exec_time_p < rem_p) { tst_res(TINFO, "Exceeded execution time, requesting exit"); exit = 1; - - if (pair->sampling > 0) { - tst_res(TWARN, - "Still sampling, consider increasing LTP_TIMEOUT_MUL"); - } } if (++pair->exec_loop > pair->exec_loops) {