From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-kernel@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Alexey Dobriyan <adobriyan@gmail.com>
Subject: [PATCHv2 2/2] lib: kstrtox: add performance test case
Date: Mon, 18 Jul 2011 15:57:54 +0300 [thread overview]
Message-ID: <f0625e0068a3efc9f7b289032ed4cc4e952178ae.1310993826.git.andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <9ebc58c68603c4a5d084e77d355b77dc72225a3f.1310993826.git.andriy.shevchenko@linux.intel.com>
In-Reply-To: <9ebc58c68603c4a5d084e77d355b77dc72225a3f.1310993826.git.andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
---
lib/test-kstrtox.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/lib/test-kstrtox.c b/lib/test-kstrtox.c
index d55769d..2da5950 100644
--- a/lib/test-kstrtox.c
+++ b/lib/test-kstrtox.c
@@ -65,6 +65,12 @@ struct test_fail {
} \
}
+static int loop_amount;
+
+module_param(loop_amount, int, 0);
+MODULE_PARM_DESC(loop_amount,
+ "Amount of loops for performance test (0 - no test)");
+
static void __init test_kstrtoull_ok(void)
{
DECLARE_TEST_OK(unsigned long long, struct test_ull);
@@ -707,6 +713,27 @@ static void __init test_kstrtos8_fail(void)
TEST_FAIL(kstrtos8, s8, "%hhd", test_s8_fail);
}
+static void __init test_kstrtox_perf(void)
+{
+ struct timespec ts, ts1, ts2;
+ int count = loop_amount;
+
+ if (!loop_amount)
+ return;
+
+ getnstimeofday(&ts1);
+ while (count--) {
+ test_kstrtoull_ok();
+ test_kstrtoull_fail();
+ }
+ getnstimeofday(&ts2);
+ ts = timespec_sub(ts2, ts1);
+
+ printk(KERN_INFO "kstrox: %d conversions of strings took %lu.%09lu "
+ "seconds\n", loop_amount,
+ (unsigned long)ts.tv_sec, (unsigned long)ts.tv_nsec);
+}
+
static int __init test_kstrtox_init(void)
{
test_kstrtoull_ok();
@@ -733,6 +760,9 @@ static int __init test_kstrtox_init(void)
test_kstrtou8_fail();
test_kstrtos8_ok();
test_kstrtos8_fail();
+
+ test_kstrtox_perf();
+
return -EINVAL;
}
module_init(test_kstrtox_init);
--
1.7.5.4
next prev parent reply other threads:[~2011-07-18 12:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-18 8:23 [PATCH 1/2] lib: make TOLOWER macro public Andy Shevchenko
2011-07-18 8:23 ` [PATCH 2/2] lib: call native hex_to_bin() inside _kstrtoull() Andy Shevchenko
2011-07-18 10:31 ` Alexey Dobriyan
2011-07-18 10:39 ` Andy Shevchenko
2011-07-18 12:57 ` [PATCHv2 1/2] lib: make _tolower() public Andy Shevchenko
2011-07-18 12:57 ` Andy Shevchenko [this message]
2011-07-18 20:52 ` Alexey Dobriyan
2011-07-19 7:17 ` [PATCHv2.1] " Andy Shevchenko
2011-07-18 19:05 ` [PATCH 2/2] lib: call native hex_to_bin() inside _kstrtoull() Andy Shevchenko
2011-07-18 10:25 ` [PATCH 1/2] lib: make TOLOWER macro public Alexey Dobriyan
2011-07-18 10:36 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f0625e0068a3efc9f7b289032ed4cc4e952178ae.1310993826.git.andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®