MCPcopy Create free account
hub / github.com/AutonomousVehicleLaboratory/SemVecNet / profile

Function profile

semantic_mapping/src/utils/utils.py:16–31  ·  view source on GitHub ↗

A decorator that uses cProfile to profile a function

(function)

Source from the content-addressed store, hash-verified

14
15
16def profile(function):
17 """ A decorator that uses cProfile to profile a function """
18
19 def inner(*args, **argv):
20 pr = cProfile.Profile()
21 pr.enable()
22 retval = function(*args, **argv)
23 pr.disable()
24 s = io.StringIO()
25 sortby = 'cumulative'
26 ps = pstats.Stats(pr).sort_stats(sortby)
27 ps.print_stats(0.1)
28 print(s.getvalue())
29 return retval
30
31 return inner
32
33
34def homogenize(x):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected