MCPcopy Index your code
hub / github.com/python/cpython / strip_dirs

Method strip_dirs

Lib/pstats.py:283–310  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

281 return self
282
283 def strip_dirs(self):
284 oldstats = self.stats
285 self.stats = newstats = {}
286 max_name_len = 0
287 for func, (cc, nc, tt, ct, callers) in oldstats.items():
288 newfunc = func_strip_path(func)
289 if len(func_std_string(newfunc)) > max_name_len:
290 max_name_len = len(func_std_string(newfunc))
291 newcallers = {}
292 for func2, caller in callers.items():
293 newcallers[func_strip_path(func2)] = caller
294
295 if newfunc in newstats:
296 newstats[newfunc] = add_func_stats(
297 newstats[newfunc],
298 (cc, nc, tt, ct, newcallers))
299 else:
300 newstats[newfunc] = (cc, nc, tt, ct, newcallers)
301 old_top = self.top_level
302 self.top_level = new_top = set()
303 for func in old_top:
304 new_top.add(func_strip_path(func))
305
306 self.max_name_len = max_name_len
307
308 self.fcn_list = None
309 self.all_callees = None
310 return self
311
312 def calc_callees(self):
313 if self.all_callees:

Callers 5

do_profilingMethod · 0.95
do_stripMethod · 0.80
print_statsMethod · 0.80
print_statsMethod · 0.80
print_statsMethod · 0.80

Calls 6

func_strip_pathFunction · 0.85
func_std_stringFunction · 0.85
add_func_statsFunction · 0.85
setFunction · 0.85
itemsMethod · 0.45
addMethod · 0.45

Tested by 1

do_profilingMethod · 0.76