From nobody Thu Dec 16 10:53:19 2021 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 991F118F0CF8; Thu, 16 Dec 2021 10:53:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JF89D1TSfz4f6F; Thu, 16 Dec 2021 10:53:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F12A2E4F0; Thu, 16 Dec 2021 10:53:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BGArJl3091097; Thu, 16 Dec 2021 10:53:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BGArJSb091096; Thu, 16 Dec 2021 10:53:19 GMT (envelope-from git) Date: Thu, 16 Dec 2021 10:53:19 GMT Message-Id: <202112161053.1BGArJSb091096@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 70661eaafa06 - main - loader: Add a readtest command List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 70661eaafa069062317ae2c6012cc2bc303da0cc Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639652000; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cshI2i2uoCb4zW7sV62Q51kwrDwDpZiVP1RrcyG40XE=; b=n9mG37xEmQr+0pjhDj8pid4IRv+frpNXtS2xMwp5GLtXZJI5D309wWh2Sd4IfM7tcst4PA MbUqpME1Mo+GBICJczSQBX5U0d5nssBmkkvAgeQiClJa99YB0A/ahYYWx5N/pHU4oYv3K9 IRzHlF1pdAkAE+hQukXK9aMMqUyPmKFA6nG6GQsbtoG3uIjIs3cESQjq9bY1QsGTfqQdKW IkDUbZwTfIPmnq63sqawFmiWkevGW4Q1E+0iFuOuI3tsc0jVxO7IePurgkLc4+m1NqHXIj 9K697Ugx8btGkAnThxBCQ7oqSZamOt6aKc2Jprv2Kd3OKJQq8fkkT1G/FlGPpA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639652000; a=rsa-sha256; cv=none; b=KGhr+rTj8I17i4eK0wLSisSB8YtqWk2JxkWruhdQF7E8s4AGm7KyjWz3MOJ2GvDlh7BgZo WmbUluzmQ9HVIt8xoJVjnTay/+KGvXLpssoOAKHLsGwrVePr4gOSsroxGGCXX6BBmCdEsU 1wd300h2DY8ksAwTJa4GHxjyXoJz6tBvIzBUGD/8nBLTd0uyRelDTS6k4xOhGXZzwM4Lwf 05JHne1WrzQDNNHqyYPPJCa8WloJt9V4nQXAvOh/3liSJL2b8Mp9rGNF6OI2nKGZZ9D4bC +V/t/U7KdZx/KJ3YUV2n0JB6JtF4PxynkyjNbYdB0ww9lGKyVO2flqHz9BCIzw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=70661eaafa069062317ae2c6012cc2bc303da0cc commit 70661eaafa069062317ae2c6012cc2bc303da0cc Author: Emmanuel Vadot AuthorDate: 2021-12-09 13:54:58 +0000 Commit: Emmanuel Vadot CommitDate: 2021-12-16 10:50:31 +0000 loader: Add a readtest command readtest will simply load the file in memory, useful for timing loading on some filesystems. Reviewed by: tsoome MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33411 --- stand/common/commands.c | 31 +++++++++++++++++++++++++++++++ stand/libsa/tftp.c | 1 + 2 files changed, 32 insertions(+) diff --git a/stand/common/commands.c b/stand/common/commands.c index 9f7252014d87..0d21ed44c681 100644 --- a/stand/common/commands.c +++ b/stand/common/commands.c @@ -545,3 +545,34 @@ command_lsdev(int argc, char *argv[]) pager_close(); return (CMD_OK); } + +static int +command_readtest(int argc, char *argv[]) +{ + int fd; + time_t start, end; + char buf[512]; + ssize_t rv, count = 0; + + if (argc != 2) { + snprintf(command_errbuf, sizeof(command_errbuf), + "Usage: readtest "); + return (CMD_ERROR); + } + + start = getsecs(); + if ((fd = open(argv[1], O_RDONLY)) < 0) { + snprintf(command_errbuf, sizeof(command_errbuf), + "can't open '%s'", argv[1]); + return (CMD_ERROR); + } + while ((rv = read(fd, buf, sizeof(buf))) > 0) + count += rv; + end = getsecs(); + + printf("Received %zd bytes during %jd seconds\n", count, (intmax_t)end - start); + close(fd); + return (CMD_OK); +} + +COMMAND_SET(readtest, "readtest", "Time a file read", command_readtest); diff --git a/stand/libsa/tftp.c b/stand/libsa/tftp.c index 80156cf95ef0..78eedddcb1f6 100644 --- a/stand/libsa/tftp.c +++ b/stand/libsa/tftp.c @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include "stand.h" #include "net.h" #include "netif.h"