All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add input file_name support for perf sched {map|latency|replay|timehist}
@ 2019-09-03  8:55 yuzhoujian
  2019-09-09  3:49 ` 禹舟键
  0 siblings, 1 reply; 3+ messages in thread
From: yuzhoujian @ 2019-09-03  8:55 UTC (permalink / raw)
  To: peterz, mingo, alexander.shishkin, jolsa, dsahern, namhyung,
	milian.wolff, arnaldo.melo, windyu, adrian.hunter, wangnan0
  Cc: linux-perf-users, linux-kernel, acme

From: YuZhoujian <windyu@tencent.com>

Just add '-i' option for perf sched {map|latency|replay|timehist}

Signed-off-by: YuZhoujian <windyu@tencent.com>
---
 tools/perf/Documentation/perf-sched.txt | 7 +++++++
 tools/perf/builtin-sched.c              | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/tools/perf/Documentation/perf-sched.txt b/tools/perf/Documentation/perf-sched.txt
index 63f938b887dd..182c223d3d9b 100644
--- a/tools/perf/Documentation/perf-sched.txt
+++ b/tools/perf/Documentation/perf-sched.txt
@@ -80,6 +80,9 @@ OPTIONS
 
 OPTIONS for 'perf sched map'
 ----------------------------
+-i::
+--input=<file>::
+        Input file name. (default: perf.data unless stdin is a fifo)
 
 --compact::
 	Show only CPUs with activity. Helps visualizing on high core
@@ -96,6 +99,10 @@ OPTIONS for 'perf sched map'
 
 OPTIONS for 'perf sched timehist'
 ---------------------------------
+-i::
+--input=<file>::
+        Input file name. (default: perf.data unless stdin is a fifo)
+
 -k::
 --vmlinux=<file>::
     vmlinux pathname
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 025151dcb651..8e51fbb88549 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -3374,6 +3374,7 @@ int cmd_sched(int argc, const char **argv)
 	const struct option latency_options[] = {
 	OPT_STRING('s', "sort", &sched.sort_order, "key[,key2...]",
 		   "sort by key(s): runtime, switch, avg, max"),
+	OPT_STRING('i', "input", &input_name, "file", "input file name"),
 	OPT_INTEGER('C', "CPU", &sched.profile_cpu,
 		    "CPU to profile on"),
 	OPT_BOOLEAN('p', "pids", &sched.skip_merge,
@@ -3381,11 +3382,13 @@ int cmd_sched(int argc, const char **argv)
 	OPT_PARENT(sched_options)
 	};
 	const struct option replay_options[] = {
+	OPT_STRING('i', "input", &input_name, "file", "input file name"),
 	OPT_UINTEGER('r', "repeat", &sched.replay_repeat,
 		     "repeat the workload replay N times (-1: infinite)"),
 	OPT_PARENT(sched_options)
 	};
 	const struct option map_options[] = {
+	OPT_STRING('i', "input", &input_name, "file", "input file name"),
 	OPT_BOOLEAN(0, "compact", &sched.map.comp,
 		    "map output in compact mode"),
 	OPT_STRING(0, "color-pids", &sched.map.color_pids_str, "pids",
@@ -3397,6 +3400,7 @@ int cmd_sched(int argc, const char **argv)
 	OPT_PARENT(sched_options)
 	};
 	const struct option timehist_options[] = {
+	OPT_STRING('i', "input", &input_name, "file", "input file name"),
 	OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
 		   "file", "vmlinux pathname"),
 	OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name,
-- 
2.23.0.37.g745f681


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

* Re: [PATCH] Add input file_name support for perf sched {map|latency|replay|timehist}
  2019-09-03  8:55 [PATCH] Add input file_name support for perf sched {map|latency|replay|timehist} yuzhoujian
@ 2019-09-09  3:49 ` 禹舟键
  2019-09-09  8:50   ` David Ahern
  0 siblings, 1 reply; 3+ messages in thread
From: 禹舟键 @ 2019-09-09  3:49 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Alexander Shishkin, Jiri Olsa,
	David Ahern, Namhyung Kim, Milian Wolff,
	Arnaldo Carvalho de Melo, windyu, Adrian Hunter, Wang Nan
  Cc: linux-perf-users, linux-kernel, acme

PING


yuzhoujian <ufo19890607@gmail.com> 于2019年9月3日周二 下午4:56写道:
>
> From: YuZhoujian <windyu@tencent.com>
>
> Just add '-i' option for perf sched {map|latency|replay|timehist}
>
> Signed-off-by: YuZhoujian <windyu@tencent.com>
> ---
>  tools/perf/Documentation/perf-sched.txt | 7 +++++++
>  tools/perf/builtin-sched.c              | 4 ++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/tools/perf/Documentation/perf-sched.txt b/tools/perf/Documentation/perf-sched.txt
> index 63f938b887dd..182c223d3d9b 100644
> --- a/tools/perf/Documentation/perf-sched.txt
> +++ b/tools/perf/Documentation/perf-sched.txt
> @@ -80,6 +80,9 @@ OPTIONS
>
>  OPTIONS for 'perf sched map'
>  ----------------------------
> +-i::
> +--input=<file>::
> +        Input file name. (default: perf.data unless stdin is a fifo)
>
>  --compact::
>         Show only CPUs with activity. Helps visualizing on high core
> @@ -96,6 +99,10 @@ OPTIONS for 'perf sched map'
>
>  OPTIONS for 'perf sched timehist'
>  ---------------------------------
> +-i::
> +--input=<file>::
> +        Input file name. (default: perf.data unless stdin is a fifo)
> +
>  -k::
>  --vmlinux=<file>::
>      vmlinux pathname
> diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> index 025151dcb651..8e51fbb88549 100644
> --- a/tools/perf/builtin-sched.c
> +++ b/tools/perf/builtin-sched.c
> @@ -3374,6 +3374,7 @@ int cmd_sched(int argc, const char **argv)
>         const struct option latency_options[] = {
>         OPT_STRING('s', "sort", &sched.sort_order, "key[,key2...]",
>                    "sort by key(s): runtime, switch, avg, max"),
> +       OPT_STRING('i', "input", &input_name, "file", "input file name"),
>         OPT_INTEGER('C', "CPU", &sched.profile_cpu,
>                     "CPU to profile on"),
>         OPT_BOOLEAN('p', "pids", &sched.skip_merge,
> @@ -3381,11 +3382,13 @@ int cmd_sched(int argc, const char **argv)
>         OPT_PARENT(sched_options)
>         };
>         const struct option replay_options[] = {
> +       OPT_STRING('i', "input", &input_name, "file", "input file name"),
>         OPT_UINTEGER('r', "repeat", &sched.replay_repeat,
>                      "repeat the workload replay N times (-1: infinite)"),
>         OPT_PARENT(sched_options)
>         };
>         const struct option map_options[] = {
> +       OPT_STRING('i', "input", &input_name, "file", "input file name"),
>         OPT_BOOLEAN(0, "compact", &sched.map.comp,
>                     "map output in compact mode"),
>         OPT_STRING(0, "color-pids", &sched.map.color_pids_str, "pids",
> @@ -3397,6 +3400,7 @@ int cmd_sched(int argc, const char **argv)
>         OPT_PARENT(sched_options)
>         };
>         const struct option timehist_options[] = {
> +       OPT_STRING('i', "input", &input_name, "file", "input file name"),
>         OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
>                    "file", "vmlinux pathname"),
>         OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name,
> --
> 2.23.0.37.g745f681
>

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

* Re: [PATCH] Add input file_name support for perf sched {map|latency|replay|timehist}
  2019-09-09  3:49 ` 禹舟键
@ 2019-09-09  8:50   ` David Ahern
  0 siblings, 0 replies; 3+ messages in thread
From: David Ahern @ 2019-09-09  8:50 UTC (permalink / raw)
  To: 禹舟键,
	Peter Zijlstra, Ingo Molnar, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Milian Wolff, Arnaldo Carvalho de Melo, windyu,
	Adrian Hunter, Wang Nan
  Cc: linux-perf-users, linux-kernel, acme

On 9/9/19 4:49 AM, 禹舟键 wrote:
>> diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
>> index 025151dcb651..8e51fbb88549 100644
>> --- a/tools/perf/builtin-sched.c
>> +++ b/tools/perf/builtin-sched.c
>> @@ -3374,6 +3374,7 @@ int cmd_sched(int argc, const char **argv)
>>         const struct option latency_options[] = {
>>         OPT_STRING('s', "sort", &sched.sort_order, "key[,key2...]",
>>                    "sort by key(s): runtime, switch, avg, max"),
>> +       OPT_STRING('i', "input", &input_name, "file", "input file name"),
>>         OPT_INTEGER('C', "CPU", &sched.profile_cpu,
>>                     "CPU to profile on"),
>>         OPT_BOOLEAN('p', "pids", &sched.skip_merge,
>> @@ -3381,11 +3382,13 @@ int cmd_sched(int argc, const char **argv)
>>         OPT_PARENT(sched_options)
>>         };
>>         const struct option replay_options[] = {
>> +       OPT_STRING('i', "input", &input_name, "file", "input file name"),
>>         OPT_UINTEGER('r', "repeat", &sched.replay_repeat,
>>                      "repeat the workload replay N times (-1: infinite)"),
>>         OPT_PARENT(sched_options)
>>         };
>>         const struct option map_options[] = {
>> +       OPT_STRING('i', "input", &input_name, "file", "input file name"),
>>         OPT_BOOLEAN(0, "compact", &sched.map.comp,
>>                     "map output in compact mode"),
>>         OPT_STRING(0, "color-pids", &sched.map.color_pids_str, "pids",
>> @@ -3397,6 +3400,7 @@ int cmd_sched(int argc, const char **argv)
>>         OPT_PARENT(sched_options)
>>         };
>>         const struct option timehist_options[] = {
>> +       OPT_STRING('i', "input", &input_name, "file", "input file name"),
>>         OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
>>                    "file", "vmlinux pathname"),
>>         OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name,
>> --
>> 2.23.0.37.g745f681
>>

This is not needed; -i already works with timehist (and others as I
recall). I believe OPT_PARENT passes the option to the subcommand.


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

end of thread, other threads:[~2019-09-09  8:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03  8:55 [PATCH] Add input file_name support for perf sched {map|latency|replay|timehist} yuzhoujian
2019-09-09  3:49 ` 禹舟键
2019-09-09  8:50   ` David Ahern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.