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

Method parse

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

Source from the content-addressed store, hash-verified

2374 return function
2375
2376 def parse(self):
2377 self.profile[TIME] = 0.0
2378 self.profile[TOTAL_TIME] = self.stats.total_tt
2379 for fn, (cc, nc, tt, ct, callers) in self.stats.stats.items():
2380 callee = self.get_function(fn)
2381 callee.called = nc
2382 callee[TOTAL_TIME] = ct
2383 callee[TIME] = tt
2384 self.profile[TIME] += tt
2385 self.profile[TOTAL_TIME] = max(self.profile[TOTAL_TIME], ct)
2386 for fn, value in callers.items():
2387 caller = self.get_function(fn)
2388 call = Call(callee.id)
2389 if isinstance(value, tuple):
2390 for i in range(0, len(value), 4):
2391 nc, cc, tt, ct = value[i:i+4]
2392 if CALLS in call:
2393 call[CALLS] += cc
2394 else:
2395 call[CALLS] = cc
2396
2397 if TOTAL_TIME in call:
2398 call[TOTAL_TIME] += ct
2399 else:
2400 call[TOTAL_TIME] = ct
2401
2402 else:
2403 call[CALLS] = value
2404 call[TOTAL_TIME] = ratio(value, nc)*ct
2405
2406 caller.add_call(call)
2407 #self.stats.print_stats()
2408 #self.stats.print_callees()
2409
2410 # Compute derived events
2411 self.profile.validate()
2412 self.profile.ratio(TIME_RATIO, TIME)
2413 self.profile.ratio(TOTAL_TIME_RATIO, TOTAL_TIME)
2414
2415 return self.profile
2416
2417
2418class Theme:

Callers

nothing calls this directly

Calls 9

get_functionMethod · 0.95
CallClass · 0.85
rangeFunction · 0.85
ratioFunction · 0.85
add_callMethod · 0.80
ratioMethod · 0.80
maxFunction · 0.50
itemsMethod · 0.45
validateMethod · 0.45

Tested by

no test coverage detected