From patchwork Tue Oct 30 11:49:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_Bie=C3=9Fmann?= X-Patchwork-Id: 195465 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 4495A2C00A8 for ; Tue, 30 Oct 2012 22:50:03 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 08BDF4A16E; Tue, 30 Oct 2012 12:49:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A9n3r1IsOeg6; Tue, 30 Oct 2012 12:49:55 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 044264A15F; Tue, 30 Oct 2012 12:49:53 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 94BB64A15F for ; Tue, 30 Oct 2012 12:49:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7P94rlJxFbk1 for ; Tue, 30 Oct 2012 12:49:49 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-bk0-f44.google.com (mail-bk0-f44.google.com [209.85.214.44]) by theia.denx.de (Postfix) with ESMTPS id DAC524A159 for ; Tue, 30 Oct 2012 12:49:48 +0100 (CET) Received: by mail-bk0-f44.google.com with SMTP id jc3so110990bkc.3 for ; Tue, 30 Oct 2012 04:49:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=Hon7xfhFvzkC6fGf0KwkI53B61LZEQ8qavp96uwWTEM=; b=gEcHYV8jLYBJ1kJYzoo3dkkFBUdVeV8/Hc11XC8KXmXpPuTB3Df6F1rGW9AJ1u93Us pA64VYjtF9mfWPcS3xKlh2e1iboCS2lLO1Y8tZVWcsJaoX1e5UUwwky8ya57tLk/qU5a 4ppJJAw2zMMzjrks9w22Nc0cOiEdAIcyIntWkZMbpKdSxCB5RnKNuyIqxfYv/ZkeN1PI O9qeeNfAxHZhqtbVg4BEsC22Z1fxvd7fKUzqUxCTFlYp5XYcoYZn/U9IQRmlY0JAsLq9 HNvRNothjo7r9szLW35fl9sjnbTdShRKR3d5YglXnLwB2/2+nwor1fZCXm4v6CuD/01M JoqA== Received: by 10.204.150.211 with SMTP id z19mr10115897bkv.60.1351597785358; Tue, 30 Oct 2012 04:49:45 -0700 (PDT) Received: from localhost ([2a01:198:47b:1:210:75ff:fe1a:cd1e]) by mx.google.com with ESMTPS id x13sm701224bkv.16.2012.10.30.04.49.41 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 30 Oct 2012 04:49:44 -0700 (PDT) From: =?UTF-8?q?Andreas=20Bie=C3=9Fmann?= To: u-boot@lists.denx.de Date: Tue, 30 Oct 2012 12:49:26 +0100 Message-Id: <1351597766-30442-1-git-send-email-andreas.devel@googlemail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1351239610-8435-1-git-send-email-andreas.devel@googlemail.com> References: <1351239610-8435-1-git-send-email-andreas.devel@googlemail.com> MIME-Version: 1.0 Subject: [U-Boot] [PATCH v3] fs/fs.c: do_fsload: measure throughput X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This patch adds time measurement and throughput calculation for all supported fsload commands. The output of ext2load changes from ---8<--- 1830666 bytes read --->8--- to ---8<--- 1830666 bytes read in 237 ms (7.4 MiB/s) --->8--- Signed-off-by: Andreas Bießmann --- since v1: * use 'time' instead of 'time_start' as suggested by Wolfgang since v2: * rebase on top of 045fa1e1142552799ad3203e9e0bc22a11e866ea Now there is some more overhead in the measurement caused by the respective fs-type functions (detect fs-type, eventually do mount and so on). Nevertheless I think such a measurement is good for further improvements like increasing throughput by whatever measures. fs/fs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/fs.c b/fs/fs.c index 23ffa25..9f1cfed 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -246,6 +246,7 @@ int do_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], unsigned long pos; int len_read; char buf[12]; + unsigned long time; if (argc < 5) return CMD_RET_USAGE; @@ -280,11 +281,19 @@ int do_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], else pos = 0; + time = get_timer(0); len_read = fs_read(filename, addr, pos, bytes); + time = get_timer(time); if (len_read <= 0) return 1; - printf("%d bytes read\n", len_read); + printf("%d bytes read in %lu ms", len_read, time); + if (time > 0) { + puts(" ("); + print_size(len_read / time * 1000, "/s"); + puts(")"); + } + puts("\n"); sprintf(buf, "0x%x", len_read); setenv("filesize", buf);