mirror of
https://github.com/krateng/maloja.git
synced 2026-04-28 03:30:00 +00:00
Added profiler for testing, reorganized folders
This commit is contained in:
parent
2b75e1e50f
commit
4cd16d73d3
5 changed files with 14 additions and 0 deletions
14
maloja/proccontrol/profiler.py
Normal file
14
maloja/proccontrol/profiler.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import cProfile, pstats
|
||||
profiler = cProfile.Profile()
|
||||
|
||||
|
||||
|
||||
def profile(func):
|
||||
def newfunc(*args,**kwargs):
|
||||
profiler.enable()
|
||||
result = func(*args,**kwargs)
|
||||
profiler.disable()
|
||||
pstats.Stats(profiler).dump_stats(f"dev/benchmarking/{func}.stats")
|
||||
return result
|
||||
|
||||
return newfunc
|
||||
Loading…
Add table
Add a link
Reference in a new issue