public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: sched-pipe add support for packet I/O mode
@ 2016-09-27  0:29 Shuah Khan
  2016-09-27 11:37 ` Peter Zijlstra
  2016-09-27 11:38 ` Peter Zijlstra
  0 siblings, 2 replies; 4+ messages in thread
From: Shuah Khan @ 2016-09-27  0:29 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jpoimboe
  Cc: Shuah Khan, linux-kernel

Add support to run sched-pipe benchmark test on pipe with packet I/O mode.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 tools/perf/bench/sched-pipe.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tools/perf/bench/sched-pipe.c b/tools/perf/bench/sched-pipe.c
index 1dc2d13..c6e1b7a 100644
--- a/tools/perf/bench/sched-pipe.c
+++ b/tools/perf/bench/sched-pipe.c
@@ -41,9 +41,16 @@ static	int			loops = LOOPS_DEFAULT;
 /* Use processes by default: */
 static bool			threaded;
 
+/* Use non-packet (normal) I/O mode by default.
+ * In packet mode, each write is a separate packet.
+ */
+static bool			packet_mode;
+
 static const struct option options[] = {
 	OPT_INTEGER('l', "loop",	&loops,		"Specify number of loops"),
 	OPT_BOOLEAN('T', "threaded",	&threaded,	"Specify threads/process based task setup"),
+	OPT_BOOLEAN('P', "packet mode",	&packet_mode,
+		    "Specify packet I/O mode - "),
 	OPT_END()
 };
 
@@ -83,6 +90,7 @@ int bench_sched_pipe(int argc, const char **argv, const char *prefix __maybe_unu
 	unsigned long long result_usec = 0;
 	int nr_threads = 2;
 	int t;
+	int flags = 0;
 
 	/*
 	 * why does "ret" exist?
@@ -94,6 +102,18 @@ int bench_sched_pipe(int argc, const char **argv, const char *prefix __maybe_unu
 
 	argc = parse_options(argc, argv, options, bench_sched_pipe_usage, 0);
 
+	if (packet_mode) {
+		/* BUG_ON doesn't make sense exit if pipe2() fails */
+		flags = O_DIRECT;
+		ret = pipe2(pipe_1, flags);
+		if (ret)
+			exit(1);
+		ret = pipe2(pipe_2, flags);
+		if (ret)
+			exit(1);
+		printf("Running sched-pipe in packet I/O mode\n\n");
+	}
+
 	BUG_ON(pipe(pipe_1));
 	BUG_ON(pipe(pipe_2));
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-27 16:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-27  0:29 [PATCH] perf: sched-pipe add support for packet I/O mode Shuah Khan
2016-09-27 11:37 ` Peter Zijlstra
2016-09-27 11:38 ` Peter Zijlstra
2016-09-27 16:38   ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox