MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / get_stats_profile

Method get_stats_profile

tools/python-3.11.9-amd64/Lib/pstats.py:355–388  ·  view source on GitHub ↗

This method returns an instance of StatsProfile, which contains a mapping of function names to instances of FunctionProfile. Each FunctionProfile instance holds information related to the function's profile such as how long the function took to run, how many times it was c

(self)

Source from the content-addressed store, hash-verified

353 return new_list, msg
354
355 def get_stats_profile(self):
356 """This method returns an instance of StatsProfile, which contains a mapping
357 of function names to instances of FunctionProfile. Each FunctionProfile
358 instance holds information related to the function's profile such as how
359 long the function took to run, how many times it was called, etc...
360 """
361 func_list = self.fcn_list[:] if self.fcn_list else list(self.stats.keys())
362 if not func_list:
363 return StatsProfile(0, {})
364
365 total_tt = float(f8(self.total_tt))
366 func_profiles = {}
367 stats_profile = StatsProfile(total_tt, func_profiles)
368
369 for func in func_list:
370 cc, nc, tt, ct, callers = self.stats[func]
371 file_name, line_number, func_name = func
372 ncalls = str(nc) if nc == cc else (str(nc) + '/' + str(cc))
373 tottime = float(f8(tt))
374 percall_tottime = -1 if nc == 0 else float(f8(tt/nc))
375 cumtime = float(f8(ct))
376 percall_cumtime = -1 if cc == 0 else float(f8(ct/cc))
377 func_profile = FunctionProfile(
378 ncalls,
379 tottime, # time spent in this function alone
380 percall_tottime,
381 cumtime, # time spent in the function plus all functions that this function called,
382 percall_cumtime,
383 file_name,
384 line_number
385 )
386 func_profiles[func_name] = func_profile
387
388 return stats_profile
389
390 def get_print_list(self, sel_list):
391 width = self.max_name_len

Callers

nothing calls this directly

Calls 6

listFunction · 0.85
StatsProfileClass · 0.85
f8Function · 0.85
strFunction · 0.85
FunctionProfileClass · 0.85
keysMethod · 0.45

Tested by

no test coverage detected