diff options
author | Yabin Cui <yabinc@google.com> | 2018-07-25 15:02:11 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-07-25 15:02:11 -0700 |
commit | 34928248335950fa3031ddbc93bc03268b0223e1 (patch) | |
tree | 1436ef4b38505cd86b8572494485610e77b20bc5 | |
parent | f4c6f8b4ec48eb5e5fde882d3536d4028dcc0823 (diff) | |
parent | 0e5c69a63f1eeee368a715b4db549fbdec04aa1e (diff) | |
download | extras-34928248335950fa3031ddbc93bc03268b0223e1.tar.gz |
Merge "simpleperf: support long callchain in report_html.py."
am: 0e5c69a63f
Change-Id: Ic7088f77cfcc79b5b1f24b9d48a0debf4c6219d9
-rwxr-xr-x | simpleperf/scripts/report_html.py | 5 | ||||
-rw-r--r-- | simpleperf/scripts/script_testdata/perf_with_long_callchain.data | bin | 0 -> 923288 bytes | |||
-rw-r--r-- | simpleperf/scripts/test.py | 5 |
3 files changed, 10 insertions, 0 deletions
diff --git a/simpleperf/scripts/report_html.py b/simpleperf/scripts/report_html.py index c3ab0df2..511f4712 100755 --- a/simpleperf/scripts/report_html.py +++ b/simpleperf/scripts/report_html.py @@ -20,11 +20,13 @@ import collections import datetime import json import os +import sys from simpleperf_report_lib import ReportLib from utils import log_info, log_exit from utils import Addr2Nearestline, get_script_dir, Objdump, open_report_in_browser +MAX_CALLSTACK_LENGTH = 750 class HtmlWriter(object): @@ -609,6 +611,8 @@ class RecordData(object): lib_id = self.libs.get_lib_id(symbol.dso_name) func_id = self.functions.get_func_id(lib_id, symbol) callstack.append((lib_id, func_id, symbol.vaddr_in_file)) + if len(callstack) > MAX_CALLSTACK_LENGTH: + callstack = callstack[:MAX_CALLSTACK_LENGTH] thread.add_callstack(raw_sample.period, callstack, self.build_addr_hit_map) for event in self.events.values(): @@ -866,6 +870,7 @@ class ReportGenerator(object): def main(): + sys.setrecursionlimit(MAX_CALLSTACK_LENGTH * 2 + 50) parser = argparse.ArgumentParser(description='report profiling data') parser.add_argument('-i', '--record_file', nargs='+', default=['perf.data'], help=""" Set profiling data file to report. Default is perf.data.""") diff --git a/simpleperf/scripts/script_testdata/perf_with_long_callchain.data b/simpleperf/scripts/script_testdata/perf_with_long_callchain.data Binary files differnew file mode 100644 index 00000000..87e59b7c --- /dev/null +++ b/simpleperf/scripts/script_testdata/perf_with_long_callchain.data diff --git a/simpleperf/scripts/test.py b/simpleperf/scripts/test.py index 8424085b..5842baa7 100644 --- a/simpleperf/scripts/test.py +++ b/simpleperf/scripts/test.py @@ -1159,6 +1159,11 @@ class TestNativeLibDownloader(unittest.TestCase): adb.run(['shell', 'rm', '-rf', '/data/local/tmp/native_libs']) +class TestReportHtml(TestBase): + def test_long_callchain(self): + self.run_cmd(['report_html.py', '-i', 'testdata/perf_with_long_callchain.data']) + + def list_tests(): tests = [] for name, value in globals().items(): |