From patchwork Thu Nov 7 02:18:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 3150571 X-Patchwork-Delegate: dan.j.williams@gmail.com Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C1820BEEB2 for ; Thu, 7 Nov 2013 02:18:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E30182058E for ; Thu, 7 Nov 2013 02:18:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED21F205B7 for ; Thu, 7 Nov 2013 02:18:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753459Ab3KGCSY (ORCPT ); Wed, 6 Nov 2013 21:18:24 -0500 Received: from mga03.intel.com ([143.182.124.21]:6526 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753148Ab3KGCSY (ORCPT ); Wed, 6 Nov 2013 21:18:24 -0500 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 06 Nov 2013 18:18:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,535,1378882800"; d="scan'208";a="385765842" Received: from viggo.jf.intel.com ([10.23.232.61]) by azsmga001.ch.intel.com with ESMTP; 06 Nov 2013 18:18:23 -0800 Subject: [PATCH 08/10] dmatest: add basic performance metrics From: Dan Williams To: dmaengine@vger.kernel.org Cc: vinod.koul@intel.com, andriy.shevchenko@linux.intel.com Date: Wed, 06 Nov 2013 18:18:23 -0800 Message-ID: <20131107021823.15120.92673.stgit@viggo.jf.intel.com> In-Reply-To: <20131107021504.15120.47531.stgit@viggo.jf.intel.com> References: <20131107021504.15120.47531.stgit@viggo.jf.intel.com> User-Agent: StGit/0.17-1-g7c57 MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add iops and throughput to the summary output. Signed-off-by: Dan Williams Acked-by: Andy Shevchenko --- Documentation/dmatest.txt | 4 ++++ drivers/dma/dmatest.c | 35 +++++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/dmatest.txt b/Documentation/dmatest.txt index 3bf5f915212f..d89628331c2a 100644 --- a/Documentation/dmatest.txt +++ b/Documentation/dmatest.txt @@ -73,5 +73,9 @@ the parens represents additional information, e.g. error code, error counter, or status. A test thread also emits a summary line at completion listing the number of tests executed, number that failed, and a result code. +Example: + % dmesg | tail -n 1 + dmatest: dma3chan0-copy0: summary 400000 tests, 0 failures iops: 61524 KB/s 246098 (0) + The details of a data miscompare error are also emitted, but do not follow the above format. diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index d07b73275d0f..26b502069638 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -325,6 +325,29 @@ static void dbg_result(const char *err, unsigned int n, unsigned int src_off, current->comm, n, err, src_off, dst_off, len, data); } +static unsigned long long dmatest_persec(s64 runtime, unsigned int val) +{ + unsigned long long per_sec = 1000000; + + if (runtime <= 0) + return 0; + + /* drop precision until runtime is 32-bits */ + while (runtime > UINT_MAX) { + runtime >>= 1; + per_sec <<= 1; + } + + per_sec *= val; + do_div(per_sec, runtime); + return per_sec; +} + +static unsigned long long dmatest_KBs(s64 runtime, unsigned long long len) +{ + return dmatest_persec(runtime, len >> 10); +} + /* * This function repeatedly tests DMA transfers of various lengths and * offsets for a given operation type until it is told to exit by @@ -360,6 +383,9 @@ static int dmatest_func(void *data) int src_cnt; int dst_cnt; int i; + ktime_t ktime; + s64 runtime = 0; + unsigned long long total_len = 0; set_freezable(); @@ -417,6 +443,7 @@ static int dmatest_func(void *data) */ flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT; + ktime = ktime_get(); while (!kthread_should_stop() && !(params->iterations && total_tests >= params->iterations)) { struct dma_async_tx_descriptor *tx = NULL; @@ -464,6 +491,7 @@ static int dmatest_func(void *data) len = (len >> align) << align; if (!len) len = 1 << align; + total_len += len; for (i = 0; i < src_cnt; i++) { u8 *buf = thread->srcs[i] + src_off; @@ -607,6 +635,7 @@ static int dmatest_func(void *data) len, 0); } } + runtime = ktime_us_delta(ktime_get(), ktime); ret = 0; for (i = 0; thread->dsts[i]; i++) @@ -621,8 +650,10 @@ err_srcbuf: err_srcs: kfree(pq_coefs); err_thread_type: - pr_info("%s: terminating after %u tests, %u failures (status %d)\n", - current->comm, total_tests, failed_tests, ret); + pr_info("%s: summary %u tests, %u failures %llu iops %llu KB/s (%d)\n", + current->comm, total_tests, failed_tests, + dmatest_persec(runtime, total_tests), + dmatest_KBs(runtime, total_len), ret); /* terminate all transfers on specified channels */ if (ret)