MCPcopy Create free account
hub / github.com/ActiveState/code / parse_call

Method parse_call

recipes/Python/578138_gprof2dotpy/recipe-578138.py:1469–1492  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1467 call_re = re.compile(r'^\s+(?P<address>[0-9a-fA-F]+)\s+(?P<symbol>.*)\s+\((?P<module>[^)]*)\)$')
1468
1469 def parse_call(self):
1470 line = self.consume()
1471 mo = self.call_re.match(line)
1472 assert mo
1473 if not mo:
1474 return None
1475
1476 function_name = mo.group('symbol')
1477 if not function_name:
1478 function_name = mo.group('address')
1479
1480 module = mo.group('module')
1481
1482 function_id = function_name + ':' + module
1483
1484 try:
1485 function = self.profile.functions[function_id]
1486 except KeyError:
1487 function = Function(function_id, function_name)
1488 function.module = os.path.basename(module)
1489 function[SAMPLES] = 0
1490 self.profile.add_function(function)
1491
1492 return function
1493
1494
1495class OprofileParser(LineParser):

Callers 1

parse_callchainMethod · 0.95

Calls 5

FunctionClass · 0.70
consumeMethod · 0.45
matchMethod · 0.45
groupMethod · 0.45
add_functionMethod · 0.45

Tested by

no test coverage detected