diff options
author | Chris Redpath <chris.redpath@arm.com> | 2017-06-21 23:00:22 +0100 |
---|---|---|
committer | KP Singh <kpsingh@google.com> | 2017-06-27 12:10:29 +0200 |
commit | 12c3570032a60f8b3321026383d80eb318e3120f (patch) | |
tree | 23e8dc6e0bab16beaef86fef3dbfab9f8223ded9 | |
parent | c10c721b4821a050afaad471d19f5f9f66a93c78 (diff) | |
download | trappy-12c3570032a60f8b3321026383d80eb318e3120f.tar.gz |
trappy/ftrace: Raise an exception if attempting to parse .raw.txt files
Since we no longer generate these, we should let the user either remove
their text files manually or merge the files if they no longer have the
.dat file. The exception describes how to deal with this format change
and which events should be moved from the raw to the formatted text file
if the user no longer has the .dat file.
Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Reviewed-by: KP Singh <kpsingh@google.com>
-rw-r--r-- | trappy/ftrace.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/trappy/ftrace.py b/trappy/ftrace.py index 2bfa4c8..6326f32 100644 --- a/trappy/ftrace.py +++ b/trappy/ftrace.py @@ -511,6 +511,19 @@ class FTrace(GenericFTrace): self.__populate_metadata() self._do_parse() + def __warn_about_txt_trace_files(self, trace_dat, raw_txt, formatted_txt): + self.__get_raw_event_list() + warn_text = ( "You appear to be parsing both raw and formatted " + "trace files. TRAPpy now uses a unified format. " + "If you have the {} file, remove the .txt files " + "and try again. If not, you can manually move " + "lines with the following events from {} to {} :" + ).format(trace_dat, raw_txt, formatted_txt) + for raw_event in self.raw_events: + warn_text = warn_text+" \"{}\"".format(raw_event) + + raise RuntimeError(warn_text) + def __process_path(self, basepath): """Process the path and return the path to the trace text file""" @@ -520,9 +533,13 @@ class FTrace(GenericFTrace): trace_name = os.path.join(basepath, "trace") trace_txt = trace_name + ".txt" + trace_raw_txt = trace_name + ".raw.txt" trace_dat = trace_name + ".dat" if os.path.isfile(trace_dat): + # Warn users if raw.txt files are present + if os.path.isfile(trace_raw_txt): + self.__warn_about_txt_trace_files(trace_dat, trace_raw_txt, trace_txt) # TXT traces must always be generated if not os.path.isfile(trace_txt): self.__run_trace_cmd_report(trace_dat) |