From patchwork Tue Feb 2 13:34:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1434690 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2020-01-29 header.b=MK2X5x8V; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DVQmr1Jprz9sVn for ; Wed, 3 Feb 2021 00:35:37 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 5D2BE3C745F for ; Tue, 2 Feb 2021 14:35:35 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id D82A43C4F6E for ; Tue, 2 Feb 2021 14:35:32 +0100 (CET) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 244E6600977 for ; Tue, 2 Feb 2021 14:35:31 +0100 (CET) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 112DTk5b132146 for ; Tue, 2 Feb 2021 13:35:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=K8M95xCjF86qjI31SW9qaZ8tH354KJWQwg8xCTjs5k4=; b=MK2X5x8VGn5gFsODocMUxfBuzn7pRMQy9NHrOnKkMZTgvrj1lE2xARPJhcu7tLsbRfYx knczm/Bf+sVapbC7wXAuF+7Yr6YPSgHkH7siIv6sQHa4DZj1Wb6uxv6W3ASweqs2vsRE zsIA+dw9WsdzupW/YS8YpolYP8GEbNL5FMkmDcPFX6zMP9p/eto4+gBgqzeBO7acZafz Jw+7NKsPgFk7azaj9Qtu2hBPJ1UUDylC2BWa//1J3tsq67ZGFZvCB4Z7F70+rkYRTGcw ytNRaqvjj+Ob+WMA+g9dPvmrhamfa6ADQ4vaQY6DafKmtL3KXphLfeflWBbNMyZbX7ap Ig== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 36dn4wgn7q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 02 Feb 2021 13:35:29 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 112DVT7U049532; Tue, 2 Feb 2021 13:35:27 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 36dh1p15p3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Feb 2021 13:35:27 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 112DZPsr006991; Tue, 2 Feb 2021 13:35:25 GMT Received: from gyrotron.nl.oracle.com (/10.175.12.115) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 02 Feb 2021 05:35:25 -0800 From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 2 Feb 2021 16:34:52 +0300 Message-Id: <20210202133454.59224-2-alexey.kodanev@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210202133454.59224-1-alexey.kodanev@oracle.com> References: <20210202133454.59224-1-alexey.kodanev@oracle.com> MIME-Version: 1.0 X-Proofpoint-IMR: 1 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9882 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102020092 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9882 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 suspectscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102020092 X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 1/3] lib/tst_net.sh: print all netstress results in tst_netload() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" This helps during debugging when you need to see from which dataset the final result was obtained (mean). Signed-off-by: Alexey Kodanev Reviewed-by: Petr Vorel --- testcases/lib/tst_net.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh index ef9354903..f1a498306 100644 --- a/testcases/lib/tst_net.sh +++ b/testcases/lib/tst_net.sh @@ -710,7 +710,7 @@ tst_netload() tst_rhost_run -c "pkill -9 netstress\$" rm -f tst_netload.log - local res=0 + local results local passed=0 for i in $(seq 1 $run_cnt); do @@ -751,7 +751,7 @@ tst_netload() [ ! -f $rfile ] && \ tst_netload_brk TFAIL "can't read $rfile" - res="$((res + $(cat $rfile)))" + results="$results $(cat $rfile)" passed=$((passed + 1)) done @@ -761,10 +761,14 @@ tst_netload() tst_netload_brk TFAIL "expected '$expect_res' but ret: '$ret'" fi - res=$((res / $passed)) - echo "$res" > $rfile + local mean res_sum + for r in $results; do + res_sum="$((res_sum + r))" + done + mean=$((res_sum / passed)) + echo "$mean" > $rfile - tst_res_ TPASS "netstress passed, mean time '$res' ms" + tst_res_ TPASS "netstress passed, mean time $mean ms, data:$results" return $ret } From patchwork Tue Feb 2 13:34:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1434693 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2020-01-29 header.b=0DYmwXvE; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DVQqP2nb9z9t8j for ; Wed, 3 Feb 2021 00:37:53 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id E61DE3C74A9 for ; Tue, 2 Feb 2021 14:37:50 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) by picard.linux.it (Postfix) with ESMTP id 7A5BA3C745D for ; Tue, 2 Feb 2021 14:37:33 +0100 (CET) Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 3AF551000A57 for ; Tue, 2 Feb 2021 14:37:33 +0100 (CET) Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 112DTfXp032312 for ; Tue, 2 Feb 2021 13:37:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=99P/hrz4zUOEfjc9xw2Jm3knt1S7xonNm3++h+VMY1w=; b=0DYmwXvENC5AdDoqRe7HODDNJwZYI6ql/34J9x7haJ4kK3iIomSmxs3QQ1957MDKEoQI W5qDT25DNKLWEuAox+IazRjA0vNvCyFXE4vV6tmx1dVE/L1bLkDcHkReXgN5yY9Jio8b 0VJAK8aL/L/mgEBsSdZ1LNJ+m67avIcRz0iOHi+xNAl5a/QRzqEvc/22VNmqWW8wQBcx iPB9DxOaVyUu+LfrDSqqePFAiw7CwAtSnFZ5IKaoz8aWzUcPufM1mRf/AwlQPKCpFXKQ XsmilcdXwCOM40BRwsUbJ6mZUozQC0tdovZCIGr+O3rA2eO7fusSbg8JR+KyAXgAMg7C DA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 36cvyatyh8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 02 Feb 2021 13:37:31 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 112DUw1B109113; Tue, 2 Feb 2021 13:35:28 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 36dhby8kae-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Feb 2021 13:35:28 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 112DZQPg002657; Tue, 2 Feb 2021 13:35:26 GMT Received: from gyrotron.nl.oracle.com (/10.175.12.115) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 02 Feb 2021 05:35:26 -0800 From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 2 Feb 2021 16:34:53 +0300 Message-Id: <20210202133454.59224-3-alexey.kodanev@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210202133454.59224-1-alexey.kodanev@oracle.com> References: <20210202133454.59224-1-alexey.kodanev@oracle.com> MIME-Version: 1.0 X-Proofpoint-IMR: 1 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9882 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 suspectscore=0 spamscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102020092 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9882 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 spamscore=0 bulkscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102020092 X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH 2/3] lib: add tst_get_median helper binary for use in script tests X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" /tst_get_median 10 11 300 8 9 14 output: 10 Signed-off-by: Alexey Kodanev Reviewed-by: Petr Vorel --- testcases/lib/.gitignore | 1 + testcases/lib/Makefile | 3 ++- testcases/lib/tst_get_median.c | 37 ++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 testcases/lib/tst_get_median.c diff --git a/testcases/lib/.gitignore b/testcases/lib/.gitignore index 52f99dc45..bc299b6ee 100644 --- a/testcases/lib/.gitignore +++ b/testcases/lib/.gitignore @@ -2,6 +2,7 @@ /tst_checkpoint /tst_device /tst_getconf +/tst_get_median /tst_get_unused_port /tst_kvcmp /tst_net_iface_prefix diff --git a/testcases/lib/Makefile b/testcases/lib/Makefile index 4616e24c0..f77da0d56 100644 --- a/testcases/lib/Makefile +++ b/testcases/lib/Makefile @@ -28,6 +28,7 @@ INSTALL_TARGETS := *.sh MAKE_TARGETS := tst_sleep tst_random tst_checkpoint tst_rod tst_kvcmp\ tst_device tst_net_iface_prefix tst_net_ip_prefix tst_net_vars\ - tst_getconf tst_supported_fs tst_check_drivers tst_get_unused_port + tst_getconf tst_supported_fs tst_check_drivers tst_get_unused_port\ + tst_get_median include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/testcases/lib/tst_get_median.c b/testcases/lib/tst_get_median.c new file mode 100644 index 000000000..5246f12e0 --- /dev/null +++ b/testcases/lib/tst_get_median.c @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* Copyright (c) 2021 Oracle and/or its affiliates. All Rights Reserved. */ + +#include +#include + +static int cmp(const void *a, const void *b) +{ + return (*(int *)a - *(int *)b); +} + +int main(int argc, const char *argv[]) +{ + const size_t size = argc - 1; + + if (!size) { + fprintf(stderr, "Please provide a numeric list\n"); + return 1; + } + if (size == 1) { + printf("%d", atoi(argv[1])); + return 0; + } + + int arr[size]; + size_t i; + + for (i = 0; i < size; ++i) + arr[i] = atoi(argv[i + 1]); + + qsort(arr, size, sizeof(arr[0]), cmp); + + const size_t size2 = size / 2; + printf("%d", (size & 1) ? arr[size2] : ((arr[size2 - 1] + arr[size2]) / 2)); + + return 0; +} From patchwork Tue Feb 2 13:34:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1434691 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2020-01-29 header.b=YJ4uYzLX; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DVQq52tyyz9vFF for ; Wed, 3 Feb 2021 00:37:36 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 30D3E3C7462 for ; Tue, 2 Feb 2021 14:37:34 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) by picard.linux.it (Postfix) with ESMTP id 1523F3C741C for ; Tue, 2 Feb 2021 14:37:33 +0100 (CET) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 8D6A81000A57 for ; Tue, 2 Feb 2021 14:37:32 +0100 (CET) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 112DTTd9054403 for ; Tue, 2 Feb 2021 13:37:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=UwuLiGoK6yTDwQ+bNLFo/Zn9IVpLHAMXyDCjq/iRAUI=; b=YJ4uYzLX9PkLt8ZPNwxUKjVErQZeAAQjnuoaEj97BxhGhJfDhUk7PFJXfTayDQMnkIhl vXSXq3sRpsDohiQWO8MqcUOnCAVj/vexjnanGpoNcnJveT/fF3ucxKvgQnByR2Xa/C4A bYSuUPXdh5D+WrTJHEQXmenVRchP/iU4ZTaD0f6BIq3iMr3b8hUHt1ceVnqSqLN80lyv w0mLgse4m+1/zJAgb9Qwe79b2hqmOqHF4gbh9sq/xH+dUpnx4ngjSScqArB5DV5BNCm7 YYuqFQSswOJHggdvi7a/EiuWdrbwzNygKtw7NbmUhjmESGep9e01dUBuybYmr8lB4ACL nA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36cydktrcd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 02 Feb 2021 13:37:30 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 112DUCWG028841; Tue, 2 Feb 2021 13:35:28 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 36dh7rgam2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Feb 2021 13:35:28 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 112DZRDc011174; Tue, 2 Feb 2021 13:35:27 GMT Received: from gyrotron.nl.oracle.com (/10.175.12.115) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 02 Feb 2021 05:35:27 -0800 From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 2 Feb 2021 16:34:54 +0300 Message-Id: <20210202133454.59224-4-alexey.kodanev@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210202133454.59224-1-alexey.kodanev@oracle.com> References: <20210202133454.59224-1-alexey.kodanev@oracle.com> MIME-Version: 1.0 X-Proofpoint-IMR: 1 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9882 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102020092 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9882 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102020092 X-Virus-Scanned: clamav-milter 0.102.4 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH 3/3] lib/tst_net.sh: calc median instead of mean in tst_netload() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Sometimes the tests can get the following results on a test network: gre01 1 TINFO: run server 'netstress -D ltp_v0... gre01 1 TINFO: run client 'netstress -l -D ltp_v0... 5 times gre01 1 TPASS: netstress passed, mean time 4633 ms, data: 128 22627 134 142 137 ... vxlan03 1 TINFO: run server 'netstress -D ltp_v0... vxlan03 1 TINFO: run client 'netstress -l -D ltp_v0... 5 times vxlan03 1 TPASS: netstress passed, mean time 4584 ms, data: 142 140 146 145 22350 One unsuccessful run can have a huge impact on the final result, when using the mean time with such data. A more suitable solution for short runs would be to obtain a median time that can remove all outliers. This will lead to more consistent performance test results. For example, instead of the above runs, we would get this: gre01 1 TPASS: netstress passed, median time 137 ms, data: 128 22627 134 142 137 vxlan03 1 TPASS: netstress passed, median time 145 ms, data: 142 140 146 145 22350 Signed-off-by: Alexey Kodanev Reviewed-by: Petr Vorel --- testcases/lib/tst_net.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh index f1a498306..ca21fe326 100644 --- a/testcases/lib/tst_net.sh +++ b/testcases/lib/tst_net.sh @@ -761,14 +761,10 @@ tst_netload() tst_netload_brk TFAIL "expected '$expect_res' but ret: '$ret'" fi - local mean res_sum - for r in $results; do - res_sum="$((res_sum + r))" - done - mean=$((res_sum / passed)) - echo "$mean" > $rfile + local median=$(tst_get_median $results) + echo "$median" > $rfile - tst_res_ TPASS "netstress passed, mean time $mean ms, data:$results" + tst_res_ TPASS "netstress passed, median time $median ms, data:$results" return $ret }