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

Method parse

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

Source from the content-addressed store, hash-verified

1534 total.samples += partial.samples
1535
1536 def parse(self):
1537 # read lookahead
1538 self.readline()
1539
1540 self.parse_header()
1541 while self.lookahead():
1542 self.parse_entry()
1543
1544 profile = Profile()
1545
1546 reverse_call_samples = {}
1547
1548 # populate the profile
1549 profile[SAMPLES] = 0
1550 for _callers, _function, _callees in self.entries.values():
1551 function = Function(_function.id, _function.name)
1552 function[SAMPLES] = _function.samples
1553 profile.add_function(function)
1554 profile[SAMPLES] += _function.samples
1555
1556 if _function.application:
1557 function.process = os.path.basename(_function.application)
1558 if _function.image:
1559 function.module = os.path.basename(_function.image)
1560
1561 total_callee_samples = 0
1562 for _callee in _callees.values():
1563 total_callee_samples += _callee.samples
1564
1565 for _callee in _callees.values():
1566 if not _callee.self:
1567 call = Call(_callee.id)
1568 call[SAMPLES2] = _callee.samples
1569 function.add_call(call)
1570
1571 # compute derived data
1572 profile.validate()
1573 profile.find_cycles()
1574 profile.ratio(TIME_RATIO, SAMPLES)
1575 profile.call_ratios(SAMPLES2)
1576 profile.integrate(TOTAL_TIME_RATIO, TIME_RATIO)
1577
1578 return profile
1579
1580 def parse_header(self):
1581 while not self.match_header():

Callers

nothing calls this directly

Calls 15

parse_headerMethod · 0.95
parse_entryMethod · 0.95
add_functionMethod · 0.95
add_callMethod · 0.95
validateMethod · 0.95
find_cyclesMethod · 0.95
ratioMethod · 0.95
call_ratiosMethod · 0.95
integrateMethod · 0.95
CallClass · 0.85
lookaheadMethod · 0.80
ProfileClass · 0.70

Tested by

no test coverage detected