aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-script.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r--tools/perf/builtin-script.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index ccbfd56d754..ea71c5e1a94 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -24,6 +24,7 @@ static u64 nr_unordered;
24extern const struct option record_options[]; 24extern const struct option record_options[];
25static bool no_callchain; 25static bool no_callchain;
26static bool show_full_info; 26static bool show_full_info;
27static bool system_wide;
27static const char *cpu_list; 28static const char *cpu_list;
28static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); 29static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
29 30
@@ -1105,6 +1106,8 @@ static const struct option options[] = {
1105 OPT_CALLBACK('f', "fields", NULL, "str", 1106 OPT_CALLBACK('f', "fields", NULL, "str",
1106 "comma separated output fields prepend with 'type:'. Valid types: hw,sw,trace,raw. Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso,addr", 1107 "comma separated output fields prepend with 'type:'. Valid types: hw,sw,trace,raw. Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso,addr",
1107 parse_output_fields), 1108 parse_output_fields),
1109 OPT_BOOLEAN('a', "all-cpus", &system_wide,
1110 "system-wide collection from all CPUs"),
1108 OPT_STRING('C', "cpu", &cpu_list, "cpu", "list of cpus to profile"), 1111 OPT_STRING('C', "cpu", &cpu_list, "cpu", "list of cpus to profile"),
1109 OPT_STRING('c', "comms", &symbol_conf.comm_list_str, "comm[,comm...]", 1112 OPT_STRING('c', "comms", &symbol_conf.comm_list_str, "comm[,comm...]",
1110 "only display events for these comms"), 1113 "only display events for these comms"),
@@ -1134,7 +1137,6 @@ int cmd_script(int argc, const char **argv, const char *prefix __used)
1134 struct perf_session *session; 1137 struct perf_session *session;
1135 char *script_path = NULL; 1138 char *script_path = NULL;
1136 const char **__argv; 1139 const char **__argv;
1137 bool system_wide;
1138 int i, j, err; 1140 int i, j, err;
1139 1141
1140 setup_scripting(); 1142 setup_scripting();
@@ -1202,15 +1204,17 @@ int cmd_script(int argc, const char **argv, const char *prefix __used)
1202 } 1204 }
1203 1205
1204 if (!pid) { 1206 if (!pid) {
1205 system_wide = true;
1206 j = 0; 1207 j = 0;
1207 1208
1208 dup2(live_pipe[1], 1); 1209 dup2(live_pipe[1], 1);
1209 close(live_pipe[0]); 1210 close(live_pipe[0]);
1210 1211
1211 if (!is_top_script(argv[0])) 1212 if (is_top_script(argv[0])) {
1213 system_wide = true;
1214 } else if (!system_wide) {
1212 system_wide = !have_cmd(argc - rep_args, 1215 system_wide = !have_cmd(argc - rep_args,
1213 &argv[rep_args]); 1216 &argv[rep_args]);
1217 }
1214 1218
1215 __argv = malloc((argc + 6) * sizeof(const char *)); 1219 __argv = malloc((argc + 6) * sizeof(const char *));
1216 if (!__argv) 1220 if (!__argv)
@@ -1258,10 +1262,11 @@ int cmd_script(int argc, const char **argv, const char *prefix __used)
1258 script_path = rep_script_path; 1262 script_path = rep_script_path;
1259 1263
1260 if (script_path) { 1264 if (script_path) {
1261 system_wide = false;
1262 j = 0; 1265 j = 0;
1263 1266
1264 if (rec_script_path) 1267 if (!rec_script_path)
1268 system_wide = false;
1269 else if (!system_wide)
1265 system_wide = !have_cmd(argc - 1, &argv[1]); 1270 system_wide = !have_cmd(argc - 1, &argv[1]);
1266 1271
1267 __argv = malloc((argc + 2) * sizeof(const char *)); 1272 __argv = malloc((argc + 2) * sizeof(const char *));