aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2015-02-12 22:53:33 -0500
committerSteven Rostedt <rostedt@goodmis.org>2015-02-12 22:53:33 -0500
commit91367555e9be5bcab35c8403c1ebd28ef2620134 (patch)
tree0ed3989a2d8fb10ad7b3b501fe97129f8fb513b2
parent5f1a7fdc5474eda24300f10a1c7d36d94aca978c (diff)
downloadtrace-cmd-91367555e9be5bcab35c8403c1ebd28ef2620134.tar.gz
trace-cmd profile: Add -G option to make soft and hard irqs global
Instead of associating interrupts to tasks, when -G is used in trace-cmd profile or trace-cmd report, the interrupts are set to act as global events. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--Documentation/trace-cmd-profile.1.txt4
-rw-r--r--Documentation/trace-cmd-report.1.txt4
-rw-r--r--trace-local.h5
-rw-r--r--trace-profile.c11
-rw-r--r--trace-read.c13
-rw-r--r--trace-record.c13
-rw-r--r--trace-stream.c4
-rw-r--r--trace-usage.c4
8 files changed, 41 insertions, 17 deletions
diff --git a/Documentation/trace-cmd-profile.1.txt b/Documentation/trace-cmd-profile.1.txt
index 3f2050b7..f0fa30ee 100644
--- a/Documentation/trace-cmd-profile.1.txt
+++ b/Documentation/trace-cmd-profile.1.txt
@@ -46,6 +46,10 @@ These are the same as trace-cmd-record(1) with the *--profile* option.
any events (like sched_switch), unless they are specifically specified
on the command line (i.e. -p function -e sched_switch -e sched_wakeup)
+*-G*::
+ Set interrupt (soft and hard) events as global (associated to CPU
+ instead of tasks).
+
*-o* 'file'::
Write the output of the profile to 'file'. This supersedes *--stderr*
diff --git a/Documentation/trace-cmd-report.1.txt b/Documentation/trace-cmd-report.1.txt
index e186ca21..54bc70ea 100644
--- a/Documentation/trace-cmd-report.1.txt
+++ b/Documentation/trace-cmd-report.1.txt
@@ -173,6 +173,10 @@ OPTIONS
See trace-cmd-profile(1) for more details and examples.
+*-G*::
+ Set interrupt (soft and hard) events as global (associated to CPU
+ instead of tasks). Only works for --profile.
+
*-H* 'event-hooks'::
Add custom event matching to connect any two events together.
diff --git a/trace-local.h b/trace-local.h
index c08e728b..ab2bd347 100644
--- a/trace-local.h
+++ b/trace-local.h
@@ -78,12 +78,13 @@ struct hook_list;
int trace_profile_record(struct tracecmd_input *handle,
struct pevent_record *record, int cpu);
-void trace_init_profile(struct tracecmd_input *handle, struct hook_list *hooks);
+void trace_init_profile(struct tracecmd_input *handle, struct hook_list *hooks,
+ int global);
int trace_profile(void);
struct tracecmd_input *
trace_stream_init(struct buffer_instance *instance, int cpu, int fd, int cpus,
- int profile, struct hook_list *hooks);
+ int profile, struct hook_list *hooks, int global);
int trace_stream_read(struct pid_record_data *pids, int nr_pids, struct timeval *tv,
int profile);
diff --git a/trace-profile.c b/trace-profile.c
index 6f09d1c7..f19bfb40 100644
--- a/trace-profile.c
+++ b/trace-profile.c
@@ -1159,7 +1159,8 @@ static int handle_sched_wakeup_event(struct handle_data *h,
return 0;
}
-void trace_init_profile(struct tracecmd_input *handle, struct hook_list *hook)
+void trace_init_profile(struct tracecmd_input *handle, struct hook_list *hook,
+ int global)
{
struct pevent *pevent = tracecmd_get_pevent(handle);
struct event_format **events;
@@ -1305,7 +1306,7 @@ void trace_init_profile(struct tracecmd_input *handle, struct hook_list *hook)
}
if (irq_entry && irq_exit)
- mate_events(h, irq_entry, NULL, "irq", irq_exit, "irq", 0, 0);
+ mate_events(h, irq_entry, NULL, "irq", irq_exit, "irq", 0, global);
if (softirq_entry)
softirq_entry->print_func = softirq_print;
@@ -1317,10 +1318,12 @@ void trace_init_profile(struct tracecmd_input *handle, struct hook_list *hook)
softirq_raise->print_func = softirq_print;
if (softirq_entry && softirq_exit)
- mate_events(h, softirq_entry, NULL, "vec", softirq_exit, "vec", 0, 0);
+ mate_events(h, softirq_entry, NULL, "vec", softirq_exit, "vec",
+ 0, global);
if (softirq_entry && softirq_raise)
- mate_events(h, softirq_raise, NULL, "vec", softirq_entry, "vec", 0, 0);
+ mate_events(h, softirq_raise, NULL, "vec", softirq_entry, "vec",
+ 0, global);
if (fgraph_entry && fgraph_exit) {
mate_events(h, fgraph_entry, NULL, "func", fgraph_exit, "func", 1, 0);
diff --git a/trace-read.c b/trace-read.c
index 19a447e9..f3e47982 100644
--- a/trace-read.c
+++ b/trace-read.c
@@ -1007,7 +1007,8 @@ enum output_type {
OUTPUT_UNAME_ONLY,
};
-static void read_data_info(struct list_head *handle_list, enum output_type otype)
+static void read_data_info(struct list_head *handle_list, enum output_type otype,
+ int global)
{
struct handle_list *handles;
struct handle_list *last_handle;
@@ -1064,7 +1065,7 @@ static void read_data_info(struct list_head *handle_list, enum output_type otype
init_wakeup(handles->handle);
if (last_hook)
last_hook->next = tracecmd_hooks(handles->handle);
- trace_init_profile(handles->handle, hooks);
+ trace_init_profile(handles->handle, hooks, global);
process_filters(handles);
@@ -1310,6 +1311,7 @@ void trace_report (int argc, char **argv)
int test_filters = 0;
int nanosec = 0;
int no_date = 0;
+ int global = 0;
int raw = 0;
int neg = 0;
int ret = 0;
@@ -1348,7 +1350,7 @@ void trace_report (int argc, char **argv)
{NULL, 0, NULL, 0}
};
- c = getopt_long (argc-1, argv+1, "+hi:H:fepRr:tPNn:LlEwF:VvTqO:",
+ c = getopt_long (argc-1, argv+1, "+hi:H:feGpRr:tPNn:LlEwF:VvTqO:",
long_options, &option_index);
if (c == -1)
break;
@@ -1401,6 +1403,9 @@ void trace_report (int argc, char **argv)
case 'E':
show_events = 1;
break;
+ case 'G':
+ global = 1;
+ break;
case 'R':
raw = 1;
break;
@@ -1589,7 +1594,7 @@ void trace_report (int argc, char **argv)
/* yeah yeah, uname overrides stat */
if (show_uname)
otype = OUTPUT_UNAME_ONLY;
- read_data_info(&handle_list, otype);
+ read_data_info(&handle_list, otype, global);
list_for_each_entry(handles, &handle_list, list) {
tracecmd_close(handles->handle);
diff --git a/trace-record.c b/trace-record.c
index a6cf33bb..9874a12e 100644
--- a/trace-record.c
+++ b/trace-record.c
@@ -2492,7 +2492,7 @@ static void finish_network(void)
free(host);
}
-static void start_threads(enum trace_type type)
+static void start_threads(enum trace_type type, int global)
{
int profile = (type & TRACE_TYPE_PROFILE) == TRACE_TYPE_PROFILE;
struct buffer_instance *instance;
@@ -2518,7 +2518,8 @@ static void start_threads(enum trace_type type)
die("pipe");
pids[i].stream = trace_stream_init(instance, x,
brass[0], cpu_count,
- profile, hooks);
+ profile, hooks,
+ global);
if (!pids[i].stream)
die("Creating stream for %d", i);
} else
@@ -3730,6 +3731,7 @@ void trace_record (int argc, char **argv)
int extract = 0;
int stream = 0;
int profile = 0;
+ int global = 0;
int start = 0;
int run_command = 0;
int neg_event = 0;
@@ -3876,7 +3878,7 @@ void trace_record (int argc, char **argv)
if (extract)
opts = "+haf:Fp:co:O:sr:g:l:n:P:N:tb:ksiT";
else
- opts = "+hae:f:Fp:cC:dDo:O:s:r:vg:l:n:P:N:tb:R:B:ksSiTm:M:H:";
+ opts = "+hae:f:Fp:cC:dDGo:O:s:r:vg:l:n:P:N:tb:R:B:ksSiTm:M:H:";
c = getopt_long (argc-1, argv+1, opts, long_options, &option_index);
if (c == -1)
break;
@@ -3932,6 +3934,9 @@ void trace_record (int argc, char **argv)
case 'F':
filter_task = 1;
break;
+ case 'G':
+ global = 1;
+ break;
case 'P':
pids = strdup(optarg);
if (!pids)
@@ -4207,7 +4212,7 @@ void trace_record (int argc, char **argv)
if (type & (TRACE_TYPE_RECORD | TRACE_TYPE_STREAM)) {
signal(SIGINT, finish);
if (!latency)
- start_threads(type);
+ start_threads(type, global);
}
if (extract) {
diff --git a/trace-stream.c b/trace-stream.c
index 99d999d8..9ebe65b7 100644
--- a/trace-stream.c
+++ b/trace-stream.c
@@ -35,7 +35,7 @@
*/
struct tracecmd_input *
trace_stream_init(struct buffer_instance *instance, int cpu, int fd, int cpus,
- int profile, struct hook_list *hooks)
+ int profile, struct hook_list *hooks, int global)
{
struct tracecmd_input *trace_input;
struct tracecmd_output *trace_output;
@@ -76,7 +76,7 @@ trace_stream_init(struct buffer_instance *instance, int cpu, int fd, int cpus,
goto fail_free_input;
if (profile)
- trace_init_profile(trace_input, hooks);
+ trace_init_profile(trace_input, hooks, global);
make_pipe:
/* Do not block on this pipe */
diff --git a/trace-usage.c b/trace-usage.c
index d1653d24..520b14b8 100644
--- a/trace-usage.c
+++ b/trace-usage.c
@@ -125,6 +125,7 @@ static struct usage_help usage_help[] = {
" %s report [-i file] [--cpu cpu] [-e][-f][-l][-P][-L][-N][-R][-E]\\\n"
" [-r events][-n events][-F filter][-v][-V][-T][-O option]\n"
" [-H [start_system:]start_event,start_match[,pid]/[end_system:]end_event,end_match[,flags]\n"
+ " [-G]\n"
" -i input file [default trace.dat]\n"
" -e show file endianess\n"
" -f show function list\n"
@@ -147,6 +148,7 @@ static struct usage_help usage_help[] = {
" --stat - show the buffer stats that were reported at the end of the record.\n"
" --uname - show uname of the record, if it was saved\n"
" --profile report stats on where tasks are blocked and such\n"
+ " -G when profiling, set soft and hard irqs as global\n"
" -H Allows users to hook two events together for timings\n"
" (used with --profile)\n"
@@ -160,7 +162,7 @@ static struct usage_help usage_help[] = {
{
"profile",
"Start profiling and read the output directly",
- " %s profile [-e event][-p plugin][-d][-O option ][-P pid][-S][-o output]\n"
+ " %s profile [-e event][-p plugin][-d][-O option ][-P pid][-G][-S][-o output]\n"
" [-H [start_system:]start_event,start_match[,pid]/[end_system:]end_event,end_match[,flags]\n\n"
" Uses same options as record --profile.\n"
" -H Allows users to hook two events together for timings\n"