mirror of
https://github.com/krateng/maloja.git
synced 2025-07-09 03:04:07 -04:00
Moved profiler to new dev subpackage
This commit is contained in:
parent
bceb0db09a
commit
24dfa41ad9
2
maloja/dev/__init__.py
Normal file
2
maloja/dev/__init__.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
### Subpackage that takes care of all things that concern the server process itself,
|
||||||
|
### e.g. analytics
|
@ -2,7 +2,6 @@ import os
|
|||||||
|
|
||||||
import cProfile, pstats
|
import cProfile, pstats
|
||||||
|
|
||||||
|
|
||||||
from doreah.logging import log
|
from doreah.logging import log
|
||||||
from doreah.timing import Clock
|
from doreah.timing import Clock
|
||||||
|
|
||||||
@ -23,7 +22,7 @@ def profile(func):
|
|||||||
profiler.enable()
|
profiler.enable()
|
||||||
result = func(*args,**kwargs)
|
result = func(*args,**kwargs)
|
||||||
profiler.disable()
|
profiler.disable()
|
||||||
|
|
||||||
log(f"Executed {func.__name__} ({args}, {kwargs}) in {clock.stop():.2f}s",module="debug_performance")
|
log(f"Executed {func.__name__} ({args}, {kwargs}) in {clock.stop():.2f}s",module="debug_performance")
|
||||||
try:
|
try:
|
||||||
pstats.Stats(profiler).dump_stats(os.path.join(benchmarkfolder,f"{func.__name__}.stats"))
|
pstats.Stats(profiler).dump_stats(os.path.join(benchmarkfolder,f"{func.__name__}.stats"))
|
@ -25,7 +25,7 @@ from .jinjaenv.context import jinja_environment
|
|||||||
from .apis import init_apis, apikeystore
|
from .apis import init_apis, apikeystore
|
||||||
|
|
||||||
|
|
||||||
from .proccontrol.profiler import profile
|
from .dev.profiler import profile
|
||||||
|
|
||||||
|
|
||||||
######
|
######
|
||||||
|
Loading…
x
Reference in New Issue
Block a user