diff options
author | Benign X <1341398182@qq.com> | 2024-03-18 22:33:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-18 22:33:55 +0800 |
commit | 6e768540092907f17d93ea2b7bbb85ff58d8b5a9 (patch) | |
tree | a2758063eddc8cd1779b8cdc098c32953fcd5c74 /scripts/trace_filter.py | |
parent | 899d157d4c253cb5f199bdc371352cd7a101a16e (diff) | |
download | lvgl-6e768540092907f17d93ea2b7bbb85ff58d8b5a9.tar.gz lvgl-6e768540092907f17d93ea2b7bbb85ff58d8b5a9.zip |
feat(script): change trace_filter default trace log file to log_file.systrace (#5900)
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
Diffstat (limited to 'scripts/trace_filter.py')
-rwxr-xr-x | scripts/trace_filter.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/scripts/trace_filter.py b/scripts/trace_filter.py index 5fbf51db4..3ad871515 100755 --- a/scripts/trace_filter.py +++ b/scripts/trace_filter.py @@ -2,6 +2,7 @@ import argparse import re +from pathlib import Path MARK_LIST = ['tracing_mark_write'] @@ -10,20 +11,23 @@ def get_arg(): parser = argparse.ArgumentParser(description='Filter a log file to a trace file.') parser.add_argument('log_file', metavar='log_file', type=str, help='The input log file to process.') - parser.add_argument('trace_file', metavar='trace_file', type=str, nargs='?', default='trace.systrace', - help='The output trace file. If not provided, defaults to \'trace.systrace\'.') + parser.add_argument('trace_file', metavar='trace_file', type=str, nargs='?', + help='The output trace file. If not provided, defaults to \'<log_file>.systrace\'.') args = parser.parse_args() - - print('log_file: ' + args.log_file) - print('trace_file: ' + args.trace_file) - return args if __name__ == '__main__': args = get_arg() + if not args.trace_file: + log_file = Path(args.log_file) + args.trace_file = log_file.with_suffix('.systrace').as_posix() + + print('log_file :', args.log_file) + print('trace_file:', args.trace_file) + with open(args.log_file, 'r') as f: content = f.read() |