mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-31 16:27:03 +08:00
feat(script): change trace_filter default trace log file to log_file.systrace (#5900)
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
+10
-6
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import re
|
import re
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
MARK_LIST = ['tracing_mark_write']
|
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 = argparse.ArgumentParser(description='Filter a log file to a trace file.')
|
||||||
parser.add_argument('log_file', metavar='log_file', type=str,
|
parser.add_argument('log_file', metavar='log_file', type=str,
|
||||||
help='The input log file to process.')
|
help='The input log file to process.')
|
||||||
parser.add_argument('trace_file', metavar='trace_file', type=str, nargs='?', default='trace.systrace',
|
parser.add_argument('trace_file', metavar='trace_file', type=str, nargs='?',
|
||||||
help='The output trace file. If not provided, defaults to \'trace.systrace\'.')
|
help='The output trace file. If not provided, defaults to \'<log_file>.systrace\'.')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
print('log_file: ' + args.log_file)
|
|
||||||
print('trace_file: ' + args.trace_file)
|
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
args = get_arg()
|
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:
|
with open(args.log_file, 'r') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user