diff options
author | Steven Rostedt <srostedt@redhat.com> | 2011-02-25 11:10:10 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2011-02-25 11:10:10 -0500 |
commit | e97fce6d4719aff4637d9411e93717191895c6c7 (patch) | |
tree | b2b24196eafbc084b678ad21b248a5b3a3ee8a17 | |
parent | e09a5db1a929ab668c273b87c4f0a32b81e1c21a (diff) |
trace-cmd: Record date first on record, last on extract
Since record resets everything at the beginning, and may even keep
the trace going when done (-k option), it is best to record the date
before recording the trace. This way we can record the date just after
resetting the buffers before starting the trace.
Extract will record all the current data, so it is best to record the date
when the extract is done, and then it is safe to reset the buffers to
capture the date.
We also ignore date with the start option.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-record.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/trace-record.c b/trace-record.c index 52d9fd8..d73d37d 100644 --- a/trace-record.c +++ b/trace-record.c | |||
@@ -2038,6 +2038,11 @@ void trace_record (int argc, char **argv) | |||
2038 | if (!extract) { | 2038 | if (!extract) { |
2039 | fset = set_ftrace(!disable); | 2039 | fset = set_ftrace(!disable); |
2040 | disable_all(); | 2040 | disable_all(); |
2041 | |||
2042 | /* Record records the date first */ | ||
2043 | if (record && date) | ||
2044 | date2ts = get_date_to_ts(); | ||
2045 | |||
2041 | set_funcs(); | 2046 | set_funcs(); |
2042 | 2047 | ||
2043 | if (events) | 2048 | if (events) |
@@ -2119,7 +2124,8 @@ void trace_record (int argc, char **argv) | |||
2119 | printf("\n"); | 2124 | printf("\n"); |
2120 | } | 2125 | } |
2121 | 2126 | ||
2122 | if (date) | 2127 | /* extract records the date after extraction */ |
2128 | if (extract && date) | ||
2123 | date2ts = get_date_to_ts(); | 2129 | date2ts = get_date_to_ts(); |
2124 | 2130 | ||
2125 | record_data(date2ts); | 2131 | record_data(date2ts); |