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

Method integrate

recipes/Python/578138_gprof2dotpy/recipe-578138.py:359–390  ·  view source on GitHub ↗

Propagate function time ratio allong the function calls. Must be called after finding the cycles. See also: - http://citeseer.ist.psu.edu/graham82gprof.html

(self, outevent, inevent)

Source from the content-addressed store, hash-verified

357 call.ratio = ratio(call[event], total)
358
359 def integrate(self, outevent, inevent):
360 """Propagate function time ratio allong the function calls.
361
362 Must be called after finding the cycles.
363
364 See also:
365 - http://citeseer.ist.psu.edu/graham82gprof.html
366 """
367
368 # Sanity checking
369 assert outevent not in self
370 for function in self.functions.values():
371 assert outevent not in function
372 assert inevent in function
373 for call in function.calls.values():
374 assert outevent not in call
375 if call.callee_id != function.id:
376 assert call.ratio is not None
377
378 # Aggregate the input for each cycle
379 for cycle in self.cycles:
380 total = inevent.null()
381 for function in self.functions.values():
382 total = inevent.aggregate(total, function[inevent])
383 self[inevent] = total
384
385 # Integrate along the edges
386 total = inevent.null()
387 for function in self.functions.values():
388 total = inevent.aggregate(total, function[inevent])
389 self._integrate_function(function, outevent, inevent)
390 self[outevent] = total
391
392 def _integrate_function(self, function, outevent, inevent):
393 if function.cycle is not None:

Callers 9

parseMethod · 0.95
parseMethod · 0.95
parseMethod · 0.95
build_profileMethod · 0.95
parseMethod · 0.95
parseMethod · 0.45
parseMethod · 0.45
parseMethod · 0.45
parseMethod · 0.45

Calls 4

_integrate_functionMethod · 0.95
nullMethod · 0.80
valuesMethod · 0.45
aggregateMethod · 0.45

Tested by

no test coverage detected