summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2018-07-25 21:53:52 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-07-25 21:53:52 +0000
commit0e5c69a63f1eeee368a715b4db549fbdec04aa1e (patch)
tree73aaf89141adfa5facccb2b571a90af23c6ecc9b
parente5cf16f9d377c3d43e66d619e3f0c71caeee37fe (diff)
parent748896868772b0787d47b2c1eac7ba1a6f75351b (diff)
downloadextras-0e5c69a63f1eeee368a715b4db549fbdec04aa1e.tar.gz
Merge "simpleperf: support long callchain in report_html.py."
-rwxr-xr-xsimpleperf/scripts/report_html.py5
-rw-r--r--simpleperf/scripts/script_testdata/perf_with_long_callchain.databin0 -> 923288 bytes
-rw-r--r--simpleperf/scripts/test.py5
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
new file mode 100644
index 00000000..87e59b7c
--- /dev/null
+++ b/simpleperf/scripts/script_testdata/perf_with_long_callchain.data
Binary files differ
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():