This commit is contained in:
retoor 2025-02-18 13:47:34 +01:00
parent c6620ad70a
commit 91a21db89b

View File

@ -22,7 +22,8 @@ async def profile_middleware(request, handler):
async def profiler_handler(request): async def profiler_handler(request):
output = io.StringIO() output = io.StringIO()
stats = pstats.Stats(profiler, stream=output) stats = pstats.Stats(profiler, stream=output)
stats.sort_stats('cumulative') sort_by = request.query.get("sort", "tot. percall")
stats.sort_stats(sory_by)
stats.print_stats() stats.print_stats()
return web.Response(text=output.getvalue()) return web.Response(text=output.getvalue())