From 24dfa41ad9614cad43cf1380ba89db782c7dd7c4 Mon Sep 17 00:00:00 2001 From: krateng Date: Sat, 9 Apr 2022 21:20:48 +0200 Subject: [PATCH] Moved profiler to new dev subpackage --- maloja/dev/__init__.py | 2 ++ maloja/{proccontrol => dev}/profiler.py | 3 +-- maloja/server.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 maloja/dev/__init__.py rename maloja/{proccontrol => dev}/profiler.py (99%) diff --git a/maloja/dev/__init__.py b/maloja/dev/__init__.py new file mode 100644 index 0000000..1220cb9 --- /dev/null +++ b/maloja/dev/__init__.py @@ -0,0 +1,2 @@ +### Subpackage that takes care of all things that concern the server process itself, +### e.g. analytics diff --git a/maloja/proccontrol/profiler.py b/maloja/dev/profiler.py similarity index 99% rename from maloja/proccontrol/profiler.py rename to maloja/dev/profiler.py index 3a98d35..ace1c1f 100644 --- a/maloja/proccontrol/profiler.py +++ b/maloja/dev/profiler.py @@ -2,7 +2,6 @@ import os import cProfile, pstats - from doreah.logging import log from doreah.timing import Clock @@ -23,7 +22,7 @@ def profile(func): profiler.enable() result = func(*args,**kwargs) profiler.disable() - + log(f"Executed {func.__name__} ({args}, {kwargs}) in {clock.stop():.2f}s",module="debug_performance") try: pstats.Stats(profiler).dump_stats(os.path.join(benchmarkfolder,f"{func.__name__}.stats")) diff --git a/maloja/server.py b/maloja/server.py index 7805152..f0bebef 100644 --- a/maloja/server.py +++ b/maloja/server.py @@ -25,7 +25,7 @@ from .jinjaenv.context import jinja_environment from .apis import init_apis, apikeystore -from .proccontrol.profiler import profile +from .dev.profiler import profile ######