 |
|
 |
|
Next: [PATCH] tcp: set SPLICE_F_NONBLOCK after first bu..
|
| Author |
Message |
External

Since: Oct 05, 2009 Posts: 23
|
(Msg. 1) Posted: Thu Nov 05, 2009 7:21 am
Post subject: [PATCH v5 0/7] Adding general performance benchmarking subcommand to perf. Archived from groups: linux>kernel (more info?)
|
|
|
This patch series add general benchmark subcommand to perf.
The subcommand will unify the benchmarking programs
and provide these in standardized way.
I fixed this series for latest tip tree.
My previous patch series conflicts with cmd_probe().
So please discard v4 and use this v5.
Hitoshi Mitake (7):
Adding new directory and header for new subcommand 'bench'
sched-messaging.c: benchmark for scheduler and IPC mechanisms based
on hackbench
sched-pipe.c: benchmark for pipe() system call
builtin-bench.c: General framework for benchmark suites
Modifying builtin.h for new prototype
Modyfing perf.c for subcommand 'bench'
Modyfing Makefile to build subcommand 'bench'
tools/perf/Makefile | 6 +
tools/perf/bench/bench.h | 9 +
tools/perf/bench/sched-messaging.c | 332 ++++++++++++++++++++++++++++++++++++
tools/perf/bench/sched-pipe.c | 113 ++++++++++++
tools/perf/builtin-bench.c | 128 ++++++++++++++
tools/perf/builtin.h | 1 +
tools/perf/perf.c | 1 +
7 files changed, 590 insertions(+), 0 deletions(-)
create mode 100644 tools/perf/bench/bench.h
create mode 100644 tools/perf/bench/sched-messaging.c
create mode 100644 tools/perf/bench/sched-pipe.c
create mode 100644 tools/perf/builtin-bench.c
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ |
|
| Back to top |
|
 |  |
External

Since: Oct 05, 2009 Posts: 23
|
(Msg. 2) Posted: Thu Nov 05, 2009 7:21 am
Post subject: [PATCH v5 5/7] Modifying builtin.h for new prototype [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
This patch modifies builtin.h to add prototype of cmd_bench().
Signed-off-by: Hitoshi Mitake <mitake DeleteThis @dcl.info.waseda.ac.jp>
Cc: Rusty Russell <rusty DeleteThis @rustcorp.com.au>
Cc: Thomas Gleixner <tglx DeleteThis @linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra DeleteThis @chello.nl>
Cc: Mike Galbraith <efault DeleteThis @gmx.de>
---
tools/perf/builtin.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tools/perf/builtin.h b/tools/perf/builtin.h
index ad5f0f4..e84f63e 100644
--- a/tools/perf/builtin.h
+++ b/tools/perf/builtin.h
@@ -26,5 +26,6 @@ extern int cmd_top(int argc, const char **argv, const char *prefix);
extern int cmd_trace(int argc, const char **argv, const char *prefix);
extern int cmd_version(int argc, const char **argv, const char *prefix);
extern int cmd_probe(int argc, const char **argv, const char *prefix);
+extern int cmd_bench(int argc, const char **argv, const char *prefix);
#endif
--
1.6.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ |
|
| Back to top |
|
 |  |
External

Since: Oct 05, 2009 Posts: 23
|
(Msg. 3) Posted: Thu Nov 05, 2009 7:21 am
Post subject: [PATCH v5 4/7] builtin-bench.c: General framework for benchmark suites [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
This patch adds builtin-bench.c
builtin-bench.c is a general framework for benchmark suites.
Signed-off-by: Hitoshi Mitake <mitake RemoveThis @dcl.info.waseda.ac.jp>
Cc: Rusty Russell <rusty RemoveThis @rustcorp.com.au>
Cc: Thomas Gleixner <tglx RemoveThis @linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra RemoveThis @chello.nl>
Cc: Mike Galbraith <efault RemoveThis @gmx.de>
---
tools/perf/builtin-bench.c | 128 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 128 insertions(+), 0 deletions(-)
create mode 100644 tools/perf/builtin-bench.c
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
new file mode 100644
index 0000000..31f4164
--- /dev/null
+++ b/tools/perf/builtin-bench.c
@@ -0,0 +1,128 @@
+/*
+ *
+ * builtin-bench.c
+ *
+ * General benchmarking subsystem provided by perf
+ *
+ * Copyright (C) 2009, Hitoshi Mitake <mitake RemoveThis @dcl.info.waseda.ac.jp>
+ *
+ */
+
+/*
+ *
+ * Available subsystem list:
+ * sched ... scheduler and IPC mechanism
+ *
+ */
+
+#include "perf.h"
+#include "util/util.h"
+#include "util/parse-options.h"
+#include "builtin.h"
+#include "bench/bench.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+struct bench_suite {
+ const char *name;
+ const char *summary;
+ int (*fn)(int, const char **, const char *);
+};
+
+static struct bench_suite sched_suites[] = {
+ { "messaging",
+ "Benchmark for scheduler and IPC mechanisms",
+ bench_sched_messaging },
+ { "pipe",
+ "Flood of communication over pipe() between two processes",
+ bench_sched_pipe },
+ { NULL,
+ NULL,
+ NULL }
+};
+
+struct bench_subsys {
+ const char *name;
+ const char *summary;
+ struct bench_suite *suites;
+};
+
+static struct bench_subsys subsystems[] = {
+ { "sched",
+ "scheduler and IPC mechanism",
+ sched_suites },
+ { NULL,
+ NULL,
+ NULL }
+};
+
+static void dump_suites(int subsys_index)
+{
+ int i;
+
+ printf("List of available suites for %s...\n\n",
+ subsystems[subsys_index].name);
+
+ for (i = 0; subsystems[subsys_index].suites[i].name; i++)
+ printf("\t%s: %s\n",
+ subsystems[subsys_index].suites[i].name,
+ subsystems[subsys_index].suites[i].summary);
+
+ printf("\n");
+ return;
+}
+
+int cmd_bench(int argc, const char **argv, const char *prefix __used)
+{
+ int i, j, status = 0;
+
+ if (argc < 2) {
+ /* No subsystem specified. */
+ printf("Usage: perf bench <subsystem> <suite> [<options>]\n\n");
+ printf("List of available subsystems...\n\n");
+
+ for (i = 0; subsystems[i].name; i++)
+ printf("\t%s: %s\n",
+ subsystems[i].name, subsystems[i].summary);
+ printf("\n");
+
+ goto end;
+ }
+
+ for (i = 0; subsystems[i].name; i++) {
+ if (strcmp(subsystems[i].name, argv[1]))
+ continue;
+
+ if (argc < 3) {
+ /* No suite specified. */
+ dump_suites(i);
+ goto end;
+ }
+
+ for (j = 0; subsystems[i].suites[j].name; j++) {
+ if (strcmp(subsystems[i].suites[j].name, argv[2]))
+ continue;
+
+ status = subsystems[i].suites[j].fn(argc - 2,
+ argv + 2, prefix);
+ goto end;
+ }
+
+ if (!strcmp(argv[2], "-h") || !strcmp(argv[2], "--help")) {
+ dump_suites(i);
+ goto end;
+ }
+
+ printf("Unknown suite:%s for %s\n", argv[2], argv[1]);
+ status = 1;
+ goto end;
+ }
+
+ printf("Unknown subsystem:%s\n", argv[1]);
+ status = 1;
+
+end:
+ return status;
+}
--
1.6.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ |
|
| Back to top |
|
 |  |
External

Since: Oct 05, 2009 Posts: 23
|
(Msg. 4) Posted: Thu Nov 05, 2009 7:21 am
Post subject: [PATCH v5 7/7] Modyfing Makefile to build subcommand 'bench' [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
This patch modifies Makefile for new files related to 'bench' subcommand.
Signed-off-by: Hitoshi Mitake <mitake DeleteThis @dcl.info.waseda.ac.jp>
Cc: Rusty Russell <rusty DeleteThis @rustcorp.com.au>
Cc: Thomas Gleixner <tglx DeleteThis @linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra DeleteThis @chello.nl>
Cc: Mike Galbraith <efault DeleteThis @gmx.de>
---
tools/perf/Makefile | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index a130134..17f8e9d 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -427,6 +427,12 @@ BUILTIN_OBJS += builtin-timechart.o
BUILTIN_OBJS += builtin-top.o
BUILTIN_OBJS += builtin-trace.o
BUILTIN_OBJS += builtin-probe.o
+BUILTIN_OBJS += builtin-bench.o
+
+# Benchmark modules
+BUILTIN_OBJS += bench/sched-messaging.o
+BUILTIN_OBJS += bench/sched-pipe.o
+
PERFLIBS = $(LIB_FILE)
--
1.6.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ |
|
| Back to top |
|
 |  |
External

Since: Oct 05, 2009 Posts: 23
|
(Msg. 5) Posted: Thu Nov 05, 2009 7:21 am
Post subject: [PATCH v5 1/7] Adding new directory and header for new subcommand 'bench' [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
This patch adds bench/ directory and bench/bench.h.
bench/ directory will contain modules for bench subcommand.
bench/bench.h is for listing prototypes of module functions.
Signed-off-by: Hitoshi Mitake <mitake.DeleteThis@dcl.info.waseda.ac.jp>
Cc: Rusty Russell <rusty.DeleteThis@rustcorp.com.au>
Cc: Thomas Gleixner <tglx.DeleteThis@linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra.DeleteThis@chello.nl>
Cc: Mike Galbraith <efault.DeleteThis@gmx.de>
---
tools/perf/bench/bench.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
create mode 100644 tools/perf/bench/bench.h
diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h
new file mode 100644
index 0000000..59adb27
--- /dev/null
+++ b/tools/perf/bench/bench.h
@@ -0,0 +1,9 @@
+#ifndef BENCH_H
+#define BENCH_H
+
+extern int bench_sched_messaging(int argc, const char **argv,
+ const char *prefix);
+extern int bench_sched_pipe(int argc, const char **argv,
+ const char *prefix);
+
+#endif
--
1.6.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ |
|
| Back to top |
|
 |  |
External

Since: Oct 05, 2009 Posts: 23
|
(Msg. 6) Posted: Thu Nov 05, 2009 7:21 am
Post subject: [PATCH v5 6/7] Modyfing perf.c for subcommand 'bench' [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
This patch modifies perf.c for invoking 'bench' subcommand.
Signed-off-by: Hitoshi Mitake <mitake RemoveThis @dcl.info.waseda.ac.jp>
Cc: Rusty Russell <rusty RemoveThis @rustcorp.com.au>
Cc: Thomas Gleixner <tglx RemoveThis @linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra RemoveThis @chello.nl>
Cc: Mike Galbraith <efault RemoveThis @gmx.de>
---
tools/perf/perf.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 9cafe54..5877b01 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -296,6 +296,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "trace", cmd_trace, 0 },
{ "sched", cmd_sched, 0 },
{ "probe", cmd_probe, 0 },
+ { "bench", cmd_bench, 0 },
};
unsigned int i;
static const char ext[] = STRIP_EXTENSION;
--
1.6.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ |
|
| Back to top |
|
 |  |
External

Since: Oct 05, 2009 Posts: 23
|
(Msg. 7) Posted: Thu Nov 05, 2009 7:21 am
Post subject: [PATCH v5 3/7] sched-pipe.c: benchmark for pipe() system call [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
This patch adds bench/sched-pipe.c.
bench/sched-pipe.c is a benchmark program
to measure performance of pipe() system call.
This benchmark is based on pipe-test-1m.c by Ingo Molnar.
http://people.redhat.com/mingo/cfs-scheduler/tools/pipe-test-1m.c
Example of use:
% perf bench sched pipe
(executing 1000000 pipe operations between two tasks)
Total time:4.499 sec
4.499179 usecs/op
222262 ops/sec
% perf bench sched pipe -s -l 1000
0.015
Signed-off-by: Hitoshi Mitake <mitake DeleteThis @dcl.info.waseda.ac.jp>
Cc: Rusty Russell <rusty DeleteThis @rustcorp.com.au>
Cc: Thomas Gleixner <tglx DeleteThis @linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra DeleteThis @chello.nl>
Cc: Mike Galbraith <efault DeleteThis @gmx.de>
---
tools/perf/bench/sched-pipe.c | 113 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 113 insertions(+), 0 deletions(-)
create mode 100644 tools/perf/bench/sched-pipe.c
diff --git a/tools/perf/bench/sched-pipe.c b/tools/perf/bench/sched-pipe.c
new file mode 100644
index 0000000..3214ed2
--- /dev/null
+++ b/tools/perf/bench/sched-pipe.c
@@ -0,0 +1,113 @@
+/*
+ *
+ * builtin-bench-pipe.c
+ *
+ * pipe: Benchmark for pipe()
+ *
+ * Based on pipe-test-1m.c by Ingo Molnar <mingo DeleteThis @redhat.com>
+ * http://people.redhat.com/mingo/cfs-scheduler/tools/pipe-test-1m.c
+ * Ported to perf by Hitoshi Mitake <mitake DeleteThis @dcl.info.waseda.ac.jp>
+ *
+ */
+
+#include "../perf.h"
+#include "../util/util.h"
+#include "../util/parse-options.h"
+#include "../builtin.h"
+#include "bench.h"
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <linux/unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+#include <sys/time.h>
+
+#define LOOPS_DEFAULT 1000000
+static int loops = LOOPS_DEFAULT;
+static int simple = 0;
+
+static const struct option options[] = {
+ OPT_INTEGER('l', "loop", &loops,
+ "Specify number of loops"),
+ OPT_BOOLEAN('s', "simple-output", &simple,
+ "Do simple output (this maybe useful for"
+ "processing by scripts or graph tools like gnuplot)"),
+ OPT_END()
+};
+
+static const char * const bench_sched_pipe_usage[] = {
+ "perf bench sched pipe <options>",
+ NULL
+};
+
+int bench_sched_pipe(int argc, const char **argv,
+ const char *prefix __used)
+{
+ int pipe_1[2], pipe_2[2];
+ int m = 0, i;
+ struct timeval start, stop, diff;
+ unsigned long long result_usec = 0;
+
+ /*
+ * why does "ret" exist?
+ * discarding returned value of read(), write()
+ * causes error in building environment for perf
+ */
+ int ret;
+ pid_t pid;
+
+ argc = parse_options(argc, argv, options,
+ bench_sched_pipe_usage, 0);
+
+ assert(!pipe(pipe_1));
+ assert(!pipe(pipe_2));
+
+ pid = fork();
+ assert(pid >= 0);
+
+ gettimeofday(&start, NULL);
+
+ if (!pid) {
+ for (i = 0; i < loops; i++) {
+ ret = read(pipe_1[0], &m, sizeof(int));
+ ret = write(pipe_2[1], &m, sizeof(int));
+ }
+ } else {
+ for (i = 0; i < loops; i++) {
+ ret = write(pipe_1[1], &m, sizeof(int));
+ ret = read(pipe_2[0], &m, sizeof(int));
+ }
+ }
+
+ gettimeofday(&stop, NULL);
+ timersub(&stop, &start, &diff);
+
+ if (pid)
+ return 0;
+
+ if (simple)
+ printf("%lu.%03lu\n",
+ diff.tv_sec, diff.tv_usec / 1000);
+ else {
+ printf("(executing %d pipe operations between two tasks)\n\n",
+ loops);
+
+ result_usec = diff.tv_sec * 1000000;
+ result_usec += diff.tv_usec;
+
+ printf("\tTotal time:%lu.%03lu sec\n",
+ diff.tv_sec, diff.tv_usec / 1000);
+ printf("\t\t%lf usecs/op\n",
+ (double)result_usec / (double)loops);
+ printf("\t\t%d ops/sec\n",
+ (int)((double)loops /
+ ((double)result_usec / (double)1000000)));
+ }
+
+ return 0;
+}
--
1.6.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ |
|
| Back to top |
|
 |  |
|
tip-bot for Hitoshi Mitak
|
External

Since: Nov 08, 2009 Posts: 10
|
(Msg. 8) Posted: Sun Nov 08, 2009 5:20 am
Post subject: [tip:perf/bench] perf bench: Add sched-pipe.c: Benchmark for pipe() system call [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Commit-ID: c7d9300f367f480aee4663a0e3695c5b48859a1a
Gitweb: http://git.kernel.org/tip/c7d9300f367f480aee4663a0e3695c5b48859a1a
Author: Hitoshi Mitake <mitake.RemoveThis@dcl.info.waseda.ac.jp>
AuthorDate: Thu, 5 Nov 2009 09:31:33 +0900
Committer: Ingo Molnar <mingo.RemoveThis@elte.hu>
CommitDate: Sun, 8 Nov 2009 10:19:18 +0100
perf bench: Add sched-pipe.c: Benchmark for pipe() system call
This patch adds bench/sched-pipe.c.
bench/sched-pipe.c is a benchmark program
to measure performance of pipe() system call.
This benchmark is based on pipe-test-1m.c by Ingo Molnar:
http://people.redhat.com/mingo/cfs-scheduler/tools/pipe-test-1m.c
Example of use:
% perf bench sched pipe
(executing 1000000 pipe operations between two tasks)
Total time:4.499 sec
4.499179 usecs/op
222262 ops/sec
% perf bench sched pipe -s -l 1000
0.015
Signed-off-by: Hitoshi Mitake <mitake.RemoveThis@dcl.info.waseda.ac.jp>
Cc: Rusty Russell <rusty.RemoveThis@rustcorp.com.au>
Cc: Peter Zijlstra <a.p.zijlstra.RemoveThis@chello.nl>
Cc: Mike Galbraith <efault.RemoveThis@gmx.de>
Cc: Arnaldo Carvalho de Melo <acme.RemoveThis@redhat.com>
Cc: fweisbec.RemoveThis@gmail.com
Cc: Jiri Kosina <jkosina.RemoveThis@suse.cz>
LKML-Reference: <1257381097-4743-4-git-send-email-mitake.RemoveThis@dcl.info.waseda.ac.jp>
Signed-off-by: Ingo Molnar <mingo.RemoveThis@elte.hu>
---
tools/perf/bench/sched-pipe.c | 113 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 113 insertions(+), 0 deletions(-)
diff --git a/tools/perf/bench/sched-pipe.c b/tools/perf/bench/sched-pipe.c
new file mode 100644
index 0000000..3214ed2
--- /dev/null
+++ b/tools/perf/bench/sched-pipe.c
@@ -0,0 +1,113 @@
+/*
+ *
+ * builtin-bench-pipe.c
+ *
+ * pipe: Benchmark for pipe()
+ *
+ * Based on pipe-test-1m.c by Ingo Molnar <mingo.RemoveThis@redhat.com>
+ * http://people.redhat.com/mingo/cfs-scheduler/tools/pipe-test-1m.c
+ * Ported to perf by Hitoshi Mitake <mitake.RemoveThis@dcl.info.waseda.ac.jp>
+ *
+ */
+
+#include "../perf.h"
+#include "../util/util.h"
+#include "../util/parse-options.h"
+#include "../builtin.h"
+#include "bench.h"
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <linux/unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+#include <sys/time.h>
+
+#define LOOPS_DEFAULT 1000000
+static int loops = LOOPS_DEFAULT;
+static int simple = 0;
+
+static const struct option options[] = {
+ OPT_INTEGER('l', "loop", &loops,
+ "Specify number of loops"),
+ OPT_BOOLEAN('s', "simple-output", &simple,
+ "Do simple output (this maybe useful for"
+ "processing by scripts or graph tools like gnuplot)"),
+ OPT_END()
+};
+
+static const char * const bench_sched_pipe_usage[] = {
+ "perf bench sched pipe <options>",
+ NULL
+};
+
+int bench_sched_pipe(int argc, const char **argv,
+ const char *prefix __used)
+{
+ int pipe_1[2], pipe_2[2];
+ int m = 0, i;
+ struct timeval start, stop, diff;
+ unsigned long long result_usec = 0;
+
+ /*
+ * why does "ret" exist?
+ * discarding returned value of read(), write()
+ * causes error in building environment for perf
+ */
+ int ret;
+ pid_t pid;
+
+ argc = parse_options(argc, argv, options,
+ bench_sched_pipe_usage, 0);
+
+ assert(!pipe(pipe_1));
+ assert(!pipe(pipe_2));
+
+ pid = fork();
+ assert(pid >= 0);
+
+ gettimeofday(&start, NULL);
+
+ if (!pid) {
+ for (i = 0; i < loops; i++) {
+ ret = read(pipe_1[0], &m, sizeof(int));
+ ret = write(pipe_2[1], &m, sizeof(int));
+ }
+ } else {
+ for (i = 0; i < loops; i++) {
+ ret = write(pipe_1[1], &m, sizeof(int));
+ ret = read(pipe_2[0], &m, sizeof(int));
+ }
+ }
+
+ gettimeofday(&stop, NULL);
+ timersub(&stop, &start, &diff);
+
+ if (pid)
+ return 0;
+
+ if (simple)
+ printf("%lu.%03lu\n",
+ diff.tv_sec, diff.tv_usec / 1000);
+ else {
+ printf("(executing %d pipe operations between two tasks)\n\n",
+ loops);
+
+ result_usec = diff.tv_sec * 1000000;
+ result_usec += diff.tv_usec;
+
+ printf("\tTotal time:%lu.%03lu sec\n",
+ diff.tv_sec, diff.tv_usec / 1000);
+ printf("\t\t%lf usecs/op\n",
+ (double)result_usec / (double)loops);
+ printf("\t\t%d ops/sec\n",
+ (int)((double)loops /
+ ((double)result_usec / (double)1000000)));
+ }
+
+ return 0;
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.RemoveThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ |
|
| Back to top |
|
 |  |
|
tip-bot for Hitoshi Mitak
|
External

Since: Nov 08, 2009 Posts: 10
|
(Msg. 9) Posted: Sun Nov 08, 2009 5:20 am
Post subject: [tip:perf/bench] perf bench: Modify builtin.h for new prototype [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Commit-ID: 11bd341c043348ecb7462d3bd8e1ad6d00f6892a
Gitweb: http://git.kernel.org/tip/11bd341c043348ecb7462d3bd8e1ad6d00f6892a
Author: Hitoshi Mitake <mitake.TakeThisOut@dcl.info.waseda.ac.jp>
AuthorDate: Thu, 5 Nov 2009 09:31:35 +0900
Committer: Ingo Molnar <mingo.TakeThisOut@elte.hu>
CommitDate: Sun, 8 Nov 2009 10:19:19 +0100
perf bench: Modify builtin.h for new prototype
This patch modifies builtin.h to add prototype of cmd_bench().
Signed-off-by: Hitoshi Mitake <mitake.TakeThisOut@dcl.info.waseda.ac.jp>
Cc: Rusty Russell <rusty.TakeThisOut@rustcorp.com.au>
Cc: Peter Zijlstra <a.p.zijlstra.TakeThisOut@chello.nl>
Cc: Mike Galbraith <efault.TakeThisOut@gmx.de>
Cc: Arnaldo Carvalho de Melo <acme.TakeThisOut@redhat.com>
Cc: fweisbec.TakeThisOut@gmail.com
Cc: Jiri Kosina <jkosina.TakeThisOut@suse.cz>
LKML-Reference: <1257381097-4743-6-git-send-email-mitake.TakeThisOut@dcl.info.waseda.ac.jp>
Signed-off-by: Ingo Molnar <mingo.TakeThisOut@elte.hu>
---
tools/perf/builtin.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tools/perf/builtin.h b/tools/perf/builtin.h
index e11d8d2..f0cd5b1 100644
--- a/tools/perf/builtin.h
+++ b/tools/perf/builtin.h
@@ -15,6 +15,7 @@ extern int read_line_with_nul(char *buf, int size, FILE *file);
extern int check_pager_config(const char *cmd);
extern int cmd_annotate(int argc, const char **argv, const char *prefix);
+extern int cmd_bench(int argc, const char **argv, const char *prefix);
extern int cmd_help(int argc, const char **argv, const char *prefix);
extern int cmd_sched(int argc, const char **argv, const char *prefix);
extern int cmd_list(int argc, const char **argv, const char *prefix);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.TakeThisOut@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ |
|
| Back to top |
|
 |  |
|
tip-bot for Hitoshi Mitak
|
External

Since: Nov 08, 2009 Posts: 10
|
(Msg. 10) Posted: Sun Nov 08, 2009 5:20 am
Post subject: [tip:perf/bench] perf bench: Add new directory and header for new subcommand 'bench' [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Commit-ID: c426bba069e65ea438880a04aa4e7c5b880e1728
Gitweb: http://git.kernel.org/tip/c426bba069e65ea438880a04aa4e7c5b880e1728
Author: Hitoshi Mitake <mitake.DeleteThis@dcl.info.waseda.ac.jp>
AuthorDate: Thu, 5 Nov 2009 09:31:31 +0900
Committer: Ingo Molnar <mingo.DeleteThis@elte.hu>
CommitDate: Sun, 8 Nov 2009 10:19:15 +0100
perf bench: Add new directory and header for new subcommand 'bench'
This patch adds bench/ directory and bench/bench.h.
bench/ directory will contain modules for bench subcommand.
bench/bench.h is for listing prototypes of module functions.
Signed-off-by: Hitoshi Mitake <mitake.DeleteThis@dcl.info.waseda.ac.jp>
Cc: Rusty Russell <rusty.DeleteThis@rustcorp.com.au>
Cc: Peter Zijlstra <a.p.zijlstra.DeleteThis@chello.nl>
Cc: Mike Galbraith <efault.DeleteThis@gmx.de>
Cc: Arnaldo Carvalho de Melo <acme.DeleteThis@redhat.com>
Cc: fweisbec.DeleteThis@gmail.com
Cc: Jiri Kosina <jkosina.DeleteThis@suse.cz>
LKML-Reference: <1257381097-4743-2-git-send-email-mitake.DeleteThis@dcl.info.waseda.ac.jp>
Signed-off-by: Ingo Molnar <mingo.DeleteThis@elte.hu>
---
tools/perf/bench/bench.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h
new file mode 100644
index 0000000..59adb27
--- /dev/null
+++ b/tools/perf/bench/bench.h
@@ -0,0 +1,9 @@
+#ifndef BENCH_H
+#define BENCH_H
+
+extern int bench_sched_messaging(int argc, const char **argv,
+ const char *prefix);
+extern int bench_sched_pipe(int argc, const char **argv,
+ const char *prefix);
+
+#endif
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ |
|
| Back to top |
|
 |  |
External

Since: Nov 05, 2003 Posts: 2922
|
(Msg. 11) Posted: Sun Nov 08, 2009 5:20 am
Post subject: Re: [PATCH v5 0/7] Adding general performance benchmarking subcommand to perf. [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
* Hitoshi Mitake <mitake RemoveThis @dcl.info.waseda.ac.jp> wrote:
> This patch series add general benchmark subcommand to perf.
>
> The subcommand will unify the benchmarking programs
> and provide these in standardized way.
>
> I fixed this series for latest tip tree.
> My previous patch series conflicts with cmd_probe().
> So please discard v4 and use this v5.
>
> Hitoshi Mitake (7):
> Adding new directory and header for new subcommand 'bench'
> sched-messaging.c: benchmark for scheduler and IPC mechanisms based
> on hackbench
> sched-pipe.c: benchmark for pipe() system call
> builtin-bench.c: General framework for benchmark suites
> Modifying builtin.h for new prototype
> Modyfing perf.c for subcommand 'bench'
> Modyfing Makefile to build subcommand 'bench'
>
> tools/perf/Makefile | 6 +
> tools/perf/bench/bench.h | 9 +
> tools/perf/bench/sched-messaging.c | 332 ++++++++++++++++++++++++++++++++++++
> tools/perf/bench/sched-pipe.c | 113 ++++++++++++
> tools/perf/builtin-bench.c | 128 ++++++++++++++
> tools/perf/builtin.h | 1 +
> tools/perf/perf.c | 1 +
> 7 files changed, 590 insertions(+), 0 deletions(-)
> create mode 100644 tools/perf/bench/bench.h
> create mode 100644 tools/perf/bench/sched-messaging.c
> create mode 100644 tools/perf/bench/sched-pipe.c
> create mode 100644 tools/perf/builtin-bench.c
Looks good - i've applied the patches to tip:perf/bench, thanks!
There's one small bug i noticed:
$ ./perf bench sched pipe
(executing 1000000 pipe operations between two tasks)
Total time:4.898 sec
$ 4.898586 usecs/op
204140 ops/sec
the shell prompt came back before the usecs/op and ops/sec line was
printed. Process teardown race, lack of wait() or so?
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ |
|
| Back to top |
|
 |  |
|
tip-bot for Hitoshi Mitak
|
External

Since: Nov 08, 2009 Posts: 10
|
(Msg. 12) Posted: Sun Nov 08, 2009 5:20 am
Post subject: [tip:perf/bench] perf bench: Add subcommand 'bench' to the Makefile [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Commit-ID: bfde82ef51e3ea6ab8634d0fdbf5adcdd1b429cb
Gitweb: http://git.kernel.org/tip/bfde82ef51e3ea6ab8634d0fdbf5adcdd1b429cb
Author: Hitoshi Mitake <mitake RemoveThis @dcl.info.waseda.ac.jp>
AuthorDate: Thu, 5 Nov 2009 09:31:37 +0900
Committer: Ingo Molnar <mingo RemoveThis @elte.hu>
CommitDate: Sun, 8 Nov 2009 10:19:20 +0100
perf bench: Add subcommand 'bench' to the Makefile
This patch modifies Makefile for new files related to 'bench'
subcommand. The new code is active from this point on.
Signed-off-by: Hitoshi Mitake <mitake RemoveThis @dcl.info.waseda.ac.jp>
Cc: Rusty Russell <rusty RemoveThis @rustcorp.com.au>
Cc: Peter Zijlstra <a.p.zijlstra RemoveThis @chello.nl>
Cc: Mike Galbraith <efault RemoveThis @gmx.de>
Cc: Arnaldo Carvalho de Melo <acme RemoveThis @redhat.com>
Cc: fweisbec RemoveThis @gmail.com
Cc: Jiri Kosina <jkosina RemoveThis @suse.cz>
LKML-Reference: <1257381097-4743-8-git-send-email-mitake RemoveThis @dcl.info.waseda.ac.jp>
Signed-off-by: Ingo Molnar <mingo RemoveThis @elte.hu>
---
tools/perf/Makefile | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 542b29e..0a25428 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -416,6 +416,13 @@ LIB_OBJS += util/hist.o
LIB_OBJS += util/data_map.o
BUILTIN_OBJS += builtin-annotate.o
+
+BUILTIN_OBJS += builtin-bench.o
+
+# Benchmark modules
+BUILTIN_OBJS += bench/sched-messaging.o
+BUILTIN_OBJS += bench/sched-pipe.o
+
BUILTIN_OBJS += builtin-help.o
BUILTIN_OBJS += builtin-sched.o
BUILTIN_OBJS += builtin-list.o
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ |
|
| Back to top |
|
 |  |
|
tip-bot for Hitoshi Mitak
|
External

Since: Nov 08, 2009 Posts: 10
|
(Msg. 13) Posted: Sun Nov 08, 2009 5:20 am
Post subject: [tip:perf/bench] perf bench: Add builtin-bench.c: General framework for benchmark suites [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Commit-ID: 629cc356653719c206a05f4dee5c5e242edb6546
Gitweb: http://git.kernel.org/tip/629cc356653719c206a05f4dee5c5e242edb6546
Author: Hitoshi Mitake <mitake.TakeThisOut@dcl.info.waseda.ac.jp>
AuthorDate: Thu, 5 Nov 2009 09:31:34 +0900
Committer: Ingo Molnar <mingo.TakeThisOut@elte.hu>
CommitDate: Sun, 8 Nov 2009 10:19:18 +0100
perf bench: Add builtin-bench.c: General framework for benchmark suites
This patch adds builtin-bench.c
builtin-bench.c is a general framework for benchmark suites.
Signed-off-by: Hitoshi Mitake <mitake.TakeThisOut@dcl.info.waseda.ac.jp>
Cc: Rusty Russell <rusty.TakeThisOut@rustcorp.com.au>
Cc: Peter Zijlstra <a.p.zijlstra.TakeThisOut@chello.nl>
Cc: Mike Galbraith <efault.TakeThisOut@gmx.de>
Cc: Arnaldo Carvalho de Melo <acme.TakeThisOut@redhat.com>
Cc: fweisbec.TakeThisOut@gmail.com
Cc: Jiri Kosina <jkosina.TakeThisOut@suse.cz>
LKML-Reference: <1257381097-4743-5-git-send-email-mitake.TakeThisOut@dcl.info.waseda.ac.jp>
Signed-off-by: Ingo Molnar <mingo.TakeThisOut@elte.hu>
---
tools/perf/builtin-bench.c | 128 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 128 insertions(+), 0 deletions(-)
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
new file mode 100644
index 0000000..31f4164
--- /dev/null
+++ b/tools/perf/builtin-bench.c
@@ -0,0 +1,128 @@
+/*
+ *
+ * builtin-bench.c
+ *
+ * General benchmarking subsystem provided by perf
+ *
+ * Copyright (C) 2009, Hitoshi Mitake <mitake.TakeThisOut@dcl.info.waseda.ac.jp>
+ *
+ */
+
+/*
+ *
+ * Available subsystem list:
+ * sched ... scheduler and IPC mechanism
+ *
+ */
+
+#include "perf.h"
+#include "util/util.h"
+#include "util/parse-options.h"
+#include "builtin.h"
+#include "bench/bench.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+struct bench_suite {
+ const char *name;
+ const char *summary;
+ int (*fn)(int, const char **, const char *);
+};
+
+static struct bench_suite sched_suites[] = {
+ { "messaging",
+ "Benchmark for scheduler and IPC mechanisms",
+ bench_sched_messaging },
+ { "pipe",
+ "Flood of communication over pipe() between two processes",
+ bench_sched_pipe },
+ { NULL,
+ NULL,
+ NULL }
+};
+
+struct bench_subsys {
+ const char *name;
+ const char *summary;
+ struct bench_suite *suites;
+};
+
+static struct bench_subsys subsystems[] = {
+ { "sched",
+ "scheduler and IPC mechanism",
+ sched_suites },
+ { NULL,
+ NULL,
+ NULL }
+};
+
+static void dump_suites(int subsys_index)
+{
+ int i;
+
+ printf("List of available suites for %s...\n\n",
+ subsystems[subsys_index].name);
+
+ for (i = 0; subsystems[subsys_index].suites[i].name; i++)
+ printf("\t%s: %s\n",
+ subsystems[subsys_index].suites[i].name,
+ subsystems[subsys_index].suites[i].summary);
+
+ printf("\n");
+ return;
+}
+
+int cmd_bench(int argc, const char **argv, const char *prefix __used)
+{
+ int i, j, status = 0;
+
+ if (argc < 2) {
+ /* No subsystem specified. */
+ printf("Usage: perf bench <subsystem> <suite> [<options>]\n\n");
+ printf("List of available subsystems...\n\n");
+
+ for (i = 0; subsystems[i].name; i++)
+ printf("\t%s: %s\n",
+ subsystems[i].name, subsystems[i].summary);
+ printf("\n");
+
+ goto end;
+ }
+
+ for (i = 0; subsystems[i].name; i++) {
+ if (strcmp(subsystems[i].name, argv[1]))
+ continue;
+
+ if (argc < 3) {
+ /* No suite specified. */
+ dump_suites(i);
+ goto end;
+ }
+
+ for (j = 0; subsystems[i].suites[j].name; j++) {
+ if (strcmp(subsystems[i].suites[j].name, argv[2]))
+ continue;
+
+ status = subsystems[i].suites[j].fn(argc - 2,
+ argv + 2, prefix);
+ goto end;
+ }
+
+ if (!strcmp(argv[2], "-h") || !strcmp(argv[2], "--help")) {
+ dump_suites(i);
+ goto end;
+ }
+
+ printf("Unknown suite:%s for %s\n", argv[2], argv[1]);
+ status = 1;
+ goto end;
+ }
+
+ printf("Unknown subsystem:%s\n", argv[1]);
+ status = 1;
+
+end:
+ return status;
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.TakeThisOut@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ |
|
| Back to top |
|
 |  |
|
tip-bot for Hitoshi Mitak
|
External

Since: Nov 08, 2009 Posts: 10
|
(Msg. 14) Posted: Sun Nov 08, 2009 5:20 am
Post subject: [tip:perf/bench] perf bench: Add new subcommand 'bench' to perf.c [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Commit-ID: dcba8848d3bc83ec9ee0858b9ae6e4f1c1fa7fa3
Gitweb: http://git.kernel.org/tip/dcba8848d3bc83ec9ee0858b9ae6e4f1c1fa7fa3
Author: Hitoshi Mitake <mitake RemoveThis @dcl.info.waseda.ac.jp>
AuthorDate: Thu, 5 Nov 2009 09:31:36 +0900
Committer: Ingo Molnar <mingo RemoveThis @elte.hu>
CommitDate: Sun, 8 Nov 2009 10:19:19 +0100
perf bench: Add new subcommand 'bench' to perf.c
This patch modifies perf.c for invoking 'bench' subcommand.
Signed-off-by: Hitoshi Mitake <mitake RemoveThis @dcl.info.waseda.ac.jp>
Cc: Rusty Russell <rusty RemoveThis @rustcorp.com.au>
Cc: Peter Zijlstra <a.p.zijlstra RemoveThis @chello.nl>
Cc: Mike Galbraith <efault RemoveThis @gmx.de>
Cc: Arnaldo Carvalho de Melo <acme RemoveThis @redhat.com>
Cc: fweisbec RemoveThis @gmail.com
Cc: Jiri Kosina <jkosina RemoveThis @suse.cz>
LKML-Reference: <1257381097-4743-7-git-send-email-mitake RemoveThis @dcl.info.waseda.ac.jp>
Signed-off-by: Ingo Molnar <mingo RemoveThis @elte.hu>
---
tools/perf/perf.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 624e62d..f90ca5e 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -288,6 +288,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "list", cmd_list, 0 },
{ "record", cmd_record, 0 },
{ "report", cmd_report, 0 },
+ { "bench", cmd_bench, 0 },
{ "stat", cmd_stat, 0 },
{ "timechart", cmd_timechart, 0 },
{ "top", cmd_top, 0 },
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ |
|
| Back to top |
|
 |  |
External

Since: Oct 05, 2009 Posts: 23
|
(Msg. 15) Posted: Sun Nov 08, 2009 9:20 pm
Post subject: Re: [PATCH v5 0/7] Adding general performance benchmarking subcommand to perf. [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
From: Ingo Molnar <mingo.TakeThisOut@elte.hu>
Subject: Re: [PATCH v5 0/7] Adding general performance benchmarking subcommand to perf.
Date: Sun, 8 Nov 2009 10:21:21 +0100
>
> * Hitoshi Mitake <mitake.TakeThisOut@dcl.info.waseda.ac.jp> wrote:
>
> > This patch series add general benchmark subcommand to perf.
> >
> > The subcommand will unify the benchmarking programs
> > and provide these in standardized way.
> >
> > I fixed this series for latest tip tree.
> > My previous patch series conflicts with cmd_probe().
> > So please discard v4 and use this v5.
> >
> > Hitoshi Mitake (7):
> > Adding new directory and header for new subcommand 'bench'
> > sched-messaging.c: benchmark for scheduler and IPC mechanisms based
> > on hackbench
> > sched-pipe.c: benchmark for pipe() system call
> > builtin-bench.c: General framework for benchmark suites
> > Modifying builtin.h for new prototype
> > Modyfing perf.c for subcommand 'bench'
> > Modyfing Makefile to build subcommand 'bench'
> >
> > tools/perf/Makefile | 6 +
> > tools/perf/bench/bench.h | 9 +
> > tools/perf/bench/sched-messaging.c | 332 ++++++++++++++++++++++++++++++++++++
> > tools/perf/bench/sched-pipe.c | 113 ++++++++++++
> > tools/perf/builtin-bench.c | 128 ++++++++++++++
> > tools/perf/builtin.h | 1 +
> > tools/perf/perf.c | 1 +
> > 7 files changed, 590 insertions(+), 0 deletions(-)
> > create mode 100644 tools/perf/bench/bench.h
> > create mode 100644 tools/perf/bench/sched-messaging.c
> > create mode 100644 tools/perf/bench/sched-pipe.c
> > create mode 100644 tools/perf/builtin-bench.c
>
> Looks good - i've applied the patches to tip:perf/bench, thanks!
Thanks! Then I'll work on documentation and merging other
benchmarks such like lmbench or copybench.
>
> There's one small bug i noticed:
>
> $ ./perf bench sched pipe
> (executing 1000000 pipe operations between two tasks)
>
> Total time:4.898 sec
> $ 4.898586 usecs/op
> 204140 ops/sec
>
>
> the shell prompt came back before the usecs/op and ops/sec line was
> printed. Process teardown race, lack of wait() or so?
Thanks for your notify. I prepared a patch to fix this problem.
I'll send it later.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.TakeThisOut@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/ |
|
| Back to top |
|
 |  |
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
 |
|
|