diff options
author | Steven Rostedt <srostedt@redhat.com> | 2011-09-02 16:39:12 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2011-09-02 16:39:12 -0400 |
commit | 7592b9711d9b43be64bfb93fb2e91e7b2c4b141f (patch) | |
tree | c1248d99b7285f2998cfdb005abcfda05d30cd8f | |
parent | 890c635e3be43f349bceb9489b073453021464f3 (diff) |
trace-cmd: Allow report to ignore the date option
Add --nodate to trace-cmd report to ignore the date offset and give
the raw timestamp count of the records.
This also adds a flags field to the tracecmd_input struct and is set
and cleared with tracecmd_set_flag() and tracecmd_clear_flag()
respectively.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-cmd.h | 6 | ||||
-rw-r--r-- | trace-input.c | 13 | ||||
-rw-r--r-- | trace-read.c | 9 |
3 files changed, 28 insertions, 0 deletions
diff --git a/trace-cmd.h b/trace-cmd.h index af0645a..5a7c6c0 100644 --- a/trace-cmd.h +++ b/trace-cmd.h | |||
@@ -80,6 +80,10 @@ enum { | |||
80 | TRACECMD_OPTION_DATE, | 80 | TRACECMD_OPTION_DATE, |
81 | }; | 81 | }; |
82 | 82 | ||
83 | enum { | ||
84 | TRACECMD_FL_IGNORE_DATE = 1, | ||
85 | }; | ||
86 | |||
83 | struct tracecmd_ftrace { | 87 | struct tracecmd_ftrace { |
84 | struct tracecmd_input *handle; | 88 | struct tracecmd_input *handle; |
85 | struct event_format *fgraph_ret_event; | 89 | struct event_format *fgraph_ret_event; |
@@ -98,6 +102,8 @@ int tracecmd_long_size(struct tracecmd_input *handle); | |||
98 | int tracecmd_page_size(struct tracecmd_input *handle); | 102 | int tracecmd_page_size(struct tracecmd_input *handle); |
99 | int tracecmd_cpus(struct tracecmd_input *handle); | 103 | int tracecmd_cpus(struct tracecmd_input *handle); |
100 | int tracecmd_copy_headers(struct tracecmd_input *handle, int fd); | 104 | int tracecmd_copy_headers(struct tracecmd_input *handle, int fd); |
105 | void tracecmd_set_flag(struct tracecmd_input *handle, int flag); | ||
106 | void tracecmd_clear_flag(struct tracecmd_input *handle, int flag); | ||
101 | 107 | ||
102 | void tracecmd_print_events(struct tracecmd_input *handle); | 108 | void tracecmd_print_events(struct tracecmd_input *handle); |
103 | 109 | ||
diff --git a/trace-input.c b/trace-input.c index 201f5dd..a567754 100644 --- a/trace-input.c +++ b/trace-input.c | |||
@@ -77,6 +77,7 @@ struct cpu_data { | |||
77 | struct tracecmd_input { | 77 | struct tracecmd_input { |
78 | struct pevent *pevent; | 78 | struct pevent *pevent; |
79 | struct plugin_list *plugin_list; | 79 | struct plugin_list *plugin_list; |
80 | unsigned long flags; | ||
80 | int fd; | 81 | int fd; |
81 | int long_size; | 82 | int long_size; |
82 | int page_size; | 83 | int page_size; |
@@ -97,6 +98,16 @@ struct tracecmd_input { | |||
97 | 98 | ||
98 | __thread struct tracecmd_input *tracecmd_curr_thread_handle; | 99 | __thread struct tracecmd_input *tracecmd_curr_thread_handle; |
99 | 100 | ||
101 | void tracecmd_set_flag(struct tracecmd_input *handle, int flag) | ||
102 | { | ||
103 | handle->flags |= flag; | ||
104 | } | ||
105 | |||
106 | void tracecmd_clear_flag(struct tracecmd_input *handle, int flag) | ||
107 | { | ||
108 | handle->flags &= ~flag; | ||
109 | } | ||
110 | |||
100 | #if DEBUG_RECORD | 111 | #if DEBUG_RECORD |
101 | static void remove_record(struct page *page, struct record *record) | 112 | static void remove_record(struct page *page, struct record *record) |
102 | { | 113 | { |
@@ -1998,6 +2009,8 @@ static int handle_options(struct tracecmd_input *handle) | |||
1998 | * gtod. It is stored as ASCII with '0x' | 2009 | * gtod. It is stored as ASCII with '0x' |
1999 | * appended. | 2010 | * appended. |
2000 | */ | 2011 | */ |
2012 | if (handle->flags & TRACECMD_FL_IGNORE_DATE) | ||
2013 | break; | ||
2001 | offset = strtoll(buf, NULL, 0); | 2014 | offset = strtoll(buf, NULL, 0); |
2002 | /* Convert from micro to nano */ | 2015 | /* Convert from micro to nano */ |
2003 | offset *= 1000; | 2016 | offset *= 1000; |
diff --git a/trace-read.c b/trace-read.c index 2e45bff..71a58be 100644 --- a/trace-read.c +++ b/trace-read.c | |||
@@ -826,6 +826,7 @@ static void process_plugin_option(char *option) | |||
826 | } | 826 | } |
827 | 827 | ||
828 | enum { | 828 | enum { |
829 | OPT_nodate = 251, | ||
829 | OPT_check_event_parsing = 252, | 830 | OPT_check_event_parsing = 252, |
830 | OPT_kallsyms = 253, | 831 | OPT_kallsyms = 253, |
831 | OPT_events = 254, | 832 | OPT_events = 254, |
@@ -847,6 +848,7 @@ void trace_report (int argc, char **argv) | |||
847 | int show_events = 0; | 848 | int show_events = 0; |
848 | int print_events = 0; | 849 | int print_events = 0; |
849 | int test_filters = 0; | 850 | int test_filters = 0; |
851 | int no_date = 0; | ||
850 | int raw = 0; | 852 | int raw = 0; |
851 | int neg = 0; | 853 | int neg = 0; |
852 | int ret = 0; | 854 | int ret = 0; |
@@ -873,6 +875,7 @@ void trace_report (int argc, char **argv) | |||
873 | {"kallsyms", required_argument, NULL, OPT_kallsyms}, | 875 | {"kallsyms", required_argument, NULL, OPT_kallsyms}, |
874 | {"check-events", no_argument, NULL, | 876 | {"check-events", no_argument, NULL, |
875 | OPT_check_event_parsing}, | 877 | OPT_check_event_parsing}, |
878 | {"nodate", no_argument, NULL, OPT_nodate}, | ||
876 | {"help", no_argument, NULL, '?'}, | 879 | {"help", no_argument, NULL, '?'}, |
877 | {NULL, 0, NULL, 0} | 880 | {NULL, 0, NULL, 0} |
878 | }; | 881 | }; |
@@ -956,6 +959,9 @@ void trace_report (int argc, char **argv) | |||
956 | case OPT_check_event_parsing: | 959 | case OPT_check_event_parsing: |
957 | check_event_parsing = 1; | 960 | check_event_parsing = 1; |
958 | break; | 961 | break; |
962 | case OPT_nodate: | ||
963 | no_date = 1; | ||
964 | break; | ||
959 | default: | 965 | default: |
960 | usage(argv); | 966 | usage(argv); |
961 | } | 967 | } |
@@ -981,6 +987,9 @@ void trace_report (int argc, char **argv) | |||
981 | die("error reading header for %s", inputs->file); | 987 | die("error reading header for %s", inputs->file); |
982 | add_handle(handle, inputs->file); | 988 | add_handle(handle, inputs->file); |
983 | 989 | ||
990 | if (no_date) | ||
991 | tracecmd_set_flag(handle, TRACECMD_FL_IGNORE_DATE); | ||
992 | |||
984 | page_size = tracecmd_page_size(handle); | 993 | page_size = tracecmd_page_size(handle); |
985 | 994 | ||
986 | if (show_page_size) { | 995 | if (show_page_size) { |