summaryrefslogtreecommitdiff
path: root/report_sample.py
diff options
context:
space:
mode:
Diffstat (limited to 'report_sample.py')
-rwxr-xr-xreport_sample.py31
1 files changed, 5 insertions, 26 deletions
diff --git a/report_sample.py b/report_sample.py
index 7388442..dc5c4e2 100755
--- a/report_sample.py
+++ b/report_sample.py
@@ -19,7 +19,7 @@
"""
from simpleperf_report_lib import ReportLib
-from simpleperf_utils import BaseArgumentParser, flatten_arg_list
+from simpleperf_utils import BaseArgumentParser, flatten_arg_list, ReportLibOptions
from typing import List, Set, Optional
@@ -28,27 +28,19 @@ def report_sample(
symfs_dir: str,
kallsyms_file: str,
show_tracing_data: bool,
- proguard_mapping_file: List[str],
header: bool,
- comm_filter: Set[str],
- trace_offcpu: Optional[str],
- sample_filter: Optional[str]):
+ report_lib_options: ReportLibOptions):
""" read record_file, and print each sample"""
lib = ReportLib()
lib.ShowIpForUnknownSymbol()
- for file_path in proguard_mapping_file:
- lib.AddProguardMappingFile(file_path)
if symfs_dir is not None:
lib.SetSymfs(symfs_dir)
if record_file is not None:
lib.SetRecordFile(record_file)
if kallsyms_file is not None:
lib.SetKallsymsFile(kallsyms_file)
- if trace_offcpu:
- lib.SetTraceOffCpuMode(trace_offcpu)
- if sample_filter:
- lib.SetSampleFilter(sample_filter)
+ lib.SetReportOptions(report_lib_options)
if header:
print("# ========")
@@ -64,9 +56,6 @@ def report_sample(
if sample is None:
lib.Close()
break
- if comm_filter:
- if sample.thread_comm not in comm_filter:
- continue
event = lib.GetEventOfCurrentSample()
symbol = lib.GetSymbolOfCurrentSample()
callchain = lib.GetCallChainOfCurrentSample()
@@ -97,27 +86,17 @@ def main():
parser.add_argument('-i', '--record_file', nargs='?', default='perf.data',
help='Default is perf.data.')
parser.add_argument('--show_tracing_data', action='store_true', help='print tracing data.')
- parser.add_argument(
- '--proguard-mapping-file', nargs='+',
- help='Add proguard mapping file to de-obfuscate symbols',
- default=[])
parser.add_argument('--header', action='store_true',
help='Show metadata header, like perf script --header')
- parser.add_argument('--comm', nargs='+', action='append', help="""
- Use samples only in threads with selected names.""")
- parser.add_trace_offcpu_option()
- parser.add_sample_filter_options()
+ parser.add_report_lib_options()
args = parser.parse_args()
report_sample(
record_file=args.record_file,
symfs_dir=args.symfs,
kallsyms_file=args.kallsyms,
show_tracing_data=args.show_tracing_data,
- proguard_mapping_file=args.proguard_mapping_file,
header=args.header,
- comm_filter=set(flatten_arg_list(args.comm)),
- trace_offcpu=args.trace_offcpu,
- sample_filter=args.sample_filter)
+ report_lib_options=args.report_lib_options)
if __name__ == '__main__':