From: Michael Neuling <mikey@neuling.org>
To: mpe@ellerman.id.au, benh@kernel.crashing.org
Cc: mikey@neuling.org, anton@samba.org, linuxppc-dev@ozlabs.org,
Aaron Sawdey <sawdey@us.ibm.com>,
Denis Kirjanov <kda@linux-powerpc.org>,
Steve Munroe <sjmunroe@us.ibm.com>
Subject: [PATCH v2 1/2] powerpc/selftest: Add gettimeofday() benchmark
Date: Fri, 25 Sep 2015 14:01:39 +1000 [thread overview]
Message-ID: <1443153700-15395-2-git-send-email-mikey@neuling.org> (raw)
In-Reply-To: <1443153700-15395-1-git-send-email-mikey@neuling.org>
This adds a benchmark directory to the powerpc selftests and adds a
gettimeofday() benchmark to it.
Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
tools/testing/selftests/powerpc/Makefile | 2 +-
.../testing/selftests/powerpc/benchmarks/Makefile | 12 +++++++++
.../selftests/powerpc/benchmarks/gettimeofday.c | 31 ++++++++++++++++++++++
3 files changed, 44 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/selftests/powerpc/benchmarks/Makefile
create mode 100644 tools/testing/selftests/powerpc/benchmarks/gettimeofday.c
diff --git a/tools/testing/selftests/powerpc/Makefile b/tools/testing/selftests/powerpc/Makefile
index 03ca2e6..847adf6 100644
--- a/tools/testing/selftests/powerpc/Makefile
+++ b/tools/testing/selftests/powerpc/Makefile
@@ -12,7 +12,7 @@ CFLAGS := -Wall -O2 -flto -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CUR
export CFLAGS
-SUB_DIRS = pmu copyloops mm tm primitives stringloops vphn switch_endian dscr
+SUB_DIRS = pmu copyloops mm tm primitives stringloops vphn switch_endian dscr benchmarks
endif
diff --git a/tools/testing/selftests/powerpc/benchmarks/Makefile b/tools/testing/selftests/powerpc/benchmarks/Makefile
new file mode 100644
index 0000000..5fa4870
--- /dev/null
+++ b/tools/testing/selftests/powerpc/benchmarks/Makefile
@@ -0,0 +1,12 @@
+TEST_PROGS := gettimeofday
+
+CFLAGS += -O2
+
+all: $(TEST_PROGS)
+
+$(TEST_PROGS): ../harness.c
+
+include ../../lib.mk
+
+clean:
+ rm -f $(TEST_PROGS) *.o
diff --git a/tools/testing/selftests/powerpc/benchmarks/gettimeofday.c b/tools/testing/selftests/powerpc/benchmarks/gettimeofday.c
new file mode 100644
index 0000000..3af3c21
--- /dev/null
+++ b/tools/testing/selftests/powerpc/benchmarks/gettimeofday.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2015, Anton Blanchard, IBM Corp.
+ * Licensed under GPLv2.
+ */
+
+#include <sys/time.h>
+#include <stdio.h>
+
+#include "utils.h"
+
+static int test_gettimeofday(void)
+{
+ int i;
+
+ struct timeval tv_start, tv_end;
+
+ gettimeofday(&tv_start, NULL);
+
+ for(i = 0; i < 100000000; i++) {
+ gettimeofday(&tv_end, NULL);
+ }
+
+ printf("time = %.6f\n", tv_end.tv_sec - tv_start.tv_sec + (tv_end.tv_usec - tv_start.tv_usec) * 1e-6);
+
+ return 0;
+}
+
+int main(void)
+{
+ return test_harness(test_gettimeofday, "gettimeofday");
+}
--
2.1.4
next prev parent reply other threads:[~2015-09-25 4:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-25 4:01 [PATCH v2 0/2] powerpc: powerpc/vdso: Avoid link stack corruption in __get_datapage() Michael Neuling
2015-09-25 4:01 ` Michael Neuling [this message]
2015-09-25 7:39 ` [PATCH v2 1/2] powerpc/selftest: Add gettimeofday() benchmark Arnd Bergmann
2015-09-25 9:28 ` Denis Kirjanov
2015-09-25 9:37 ` Gabriel Paubert
2015-09-25 12:47 ` Denis Kirjanov
2015-09-28 8:58 ` Michael Neuling
2015-09-28 9:56 ` Denis Kirjanov
2015-09-30 1:49 ` Michael Ellerman
2015-10-02 7:47 ` [v2,1/2] " Michael Ellerman
2015-09-25 4:01 ` [PATCH v2 2/2] powerpc/vdso: Avoid link stack corruption in __get_datapage() Michael Neuling
2015-10-02 7:47 ` [v2, " Michael Ellerman
2015-10-02 8:24 ` Benjamin Herrenschmidt
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=1443153700-15395-2-git-send-email-mikey@neuling.org \
--to=mikey@neuling.org \
--cc=anton@samba.org \
--cc=benh@kernel.crashing.org \
--cc=kda@linux-powerpc.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=sawdey@us.ibm.com \
--cc=sjmunroe@us.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).