diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2021-09-28 23:07:14 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-09-28 23:07:14 +0000 |
commit | 64fcbf7c0949abb217ab81132f31e49b10521139 (patch) | |
tree | 5d297a6182f87cc38cde0a4263adf669d1c2e842 | |
parent | 7065552bf01bf25e4471d7b54ee9f0426702a2cc (diff) | |
parent | 1a2ebeaa5baa0c0b22c73fbcf068e7082dacfe4d (diff) | |
download | extras-64fcbf7c0949abb217ab81132f31e49b10521139.tar.gz |
Merge "Add pid & tid labels to pprof_proto_generator.py"
-rwxr-xr-x | simpleperf/scripts/pprof_proto_generator.py | 6 | ||||
-rw-r--r-- | simpleperf/scripts/test/pprof_proto_generator_test.py | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/simpleperf/scripts/pprof_proto_generator.py b/simpleperf/scripts/pprof_proto_generator.py index b29634da..09d54d5f 100755 --- a/simpleperf/scripts/pprof_proto_generator.py +++ b/simpleperf/scripts/pprof_proto_generator.py @@ -332,6 +332,12 @@ class PprofProfileGenerator(object): self.get_string_id("threadpool"), self.get_string_id( numbers_re.sub("%d", report_sample.thread_comm)))) + sample.labels.append(Label( + self.get_string_id("pid"), + self.get_string_id(str(report_sample.pid)))) + sample.labels.append(Label( + self.get_string_id("tid"), + self.get_string_id(str(report_sample.tid)))) if self._filter_symbol(symbol): location_id = self.get_location_id(report_sample.ip, symbol) sample.add_location_id(location_id) diff --git a/simpleperf/scripts/test/pprof_proto_generator_test.py b/simpleperf/scripts/test/pprof_proto_generator_test.py index 4a8de00b..e246faa7 100644 --- a/simpleperf/scripts/test/pprof_proto_generator_test.py +++ b/simpleperf/scripts/test/pprof_proto_generator_test.py @@ -57,6 +57,8 @@ class TestPprofProtoGenerator(TestBase): self.assertIn('label[0] = thread:Binder:10419_3', output) self.assertIn('label[0] = thread:Binder:10419_4', output) self.assertIn('label[1] = threadpool:Binder:%d_%d', output) + self.assertIn('label[2] = pid:10419', output) + self.assertIn('label[3] = tid:10459', output) def test_tid_filter(self): key1 = 'art::ProfileSaver::Run()' # function in thread 10459 |