summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2017-04-13 22:19:15 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-04-13 22:19:15 +0000
commitd2b7f6afe5671494c55ae147f308616b94a2bf3d (patch)
tree3a74afeda7f1c1f59392082d87ebb31ed1ccb212
parent248a0baefe84bc145f85b9425de4971a6f895a6c (diff)
parent5bcac01d4dbced62bbbd2f334eb662af43148f6e (diff)
downloadextras-d2b7f6afe5671494c55ae147f308616b94a2bf3d.tar.gz
Merge "simpleperf: fix pprof proto generator."
-rw-r--r--simpleperf/scripts/pprof_proto_generator.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/simpleperf/scripts/pprof_proto_generator.py b/simpleperf/scripts/pprof_proto_generator.py
index 5f8d143b..c877a167 100644
--- a/simpleperf/scripts/pprof_proto_generator.py
+++ b/simpleperf/scripts/pprof_proto_generator.py
@@ -379,11 +379,14 @@ class PprofProfileGenerator(object):
def get_location_id(self, ip, symbol):
mapping_id = self.get_mapping_id(symbol.mapping[0], symbol.dso_name)
location = Location(mapping_id, ip, symbol.vaddr_in_file)
- # Default line info only contains the function name
- line = Line()
- line.function_id = self.get_function_id(symbol.symbol_name, symbol.dso_name,
- symbol.symbol_addr)
- location.lines.append(line)
+ function_id = self.get_function_id(symbol.symbol_name, symbol.dso_name,
+ symbol.symbol_addr)
+ if function_id:
+ # Add Line only when it has a valid function id, see http://b/36988814.
+ # Default line info only contains the function name
+ line = Line()
+ line.function_id = function_id
+ location.lines.append(line)
exist_location = self.location_map.get(location.key)
if exist_location:
@@ -462,10 +465,13 @@ class PprofProfileGenerator(object):
source_id = 0
for source in sources:
if source.file and source.function and source.line:
+ function_id = self.get_function_id(source.function, dso_name, 0)
+ if function_id == 0:
+ continue
if source_id == 0:
# Clear default line info
location.lines = []
- location.lines.append(self.add_line(source, dso_name))
+ location.lines.append(self.add_line(source, dso_name, function_id))
source_id += 1
for function in self.function_list:
@@ -478,9 +484,8 @@ class PprofProfileGenerator(object):
if source.line:
function.start_line = source.line
- def add_line(self, source, dso_name):
+ def add_line(self, source, dso_name, function_id):
line = Line()
- function_id = self.get_function_id(source.function, dso_name, 0)
function = self.get_function(function_id)
function.source_filename_id = self.get_string_id(source.file)
line.function_id = function_id