From 86d9ae269d969f71e44234493f9af529253391c0 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Mon, 18 Jul 2005 06:34:34 +0000 Subject: Moved django.bin.profiling.handler to django.core.handlers.profiler-hotshot git-svn-id: http://code.djangoproject.com/svn/django/trunk@170 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/bin/profiling/handler.py | 22 ---------------------- django/core/handlers/profiler-hotshot.py | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 22 deletions(-) delete mode 100644 django/bin/profiling/handler.py create mode 100644 django/core/handlers/profiler-hotshot.py diff --git a/django/bin/profiling/handler.py b/django/bin/profiling/handler.py deleted file mode 100644 index 7074be8248..0000000000 --- a/django/bin/profiling/handler.py +++ /dev/null @@ -1,22 +0,0 @@ -import hotshot, time, os -from django.core.handler import ModPythonHandler - -PROFILE_DATA_DIR = "/var/log/cmsprofile/" - -def handler(req): - ''' - Handler that uses hotshot to store profile data. - - Stores profile data in PROFILE_DATA_DIR. Since hotshot has no way (that I - know of) to append profile data to a single file, each request gets its own - profile. The file names are in the format ..prof where is - the request path with "/" replaced by ".", and is a timestamp with - microseconds to prevent overwriting files. - - Use the gather_profile_stats.py script to gather these individual request - profiles into aggregated profiles by request path. - ''' - profname = "%s.%.3f.prof" % (req.uri.strip("/").replace('/', '.'), time.time()) - profname = os.path.join(PROFILE_DATA_DIR, profname) - prof = hotshot.Profile(profname) - return prof.runcall(ModPythonHandler(), req) diff --git a/django/core/handlers/profiler-hotshot.py b/django/core/handlers/profiler-hotshot.py new file mode 100644 index 0000000000..953cf0a722 --- /dev/null +++ b/django/core/handlers/profiler-hotshot.py @@ -0,0 +1,22 @@ +import hotshot, time, os +from django.core.handlers.modpython import ModPythonHandler + +PROFILE_DATA_DIR = "/var/log/cmsprofile/" + +def handler(req): + ''' + Handler that uses hotshot to store profile data. + + Stores profile data in PROFILE_DATA_DIR. Since hotshot has no way (that I + know of) to append profile data to a single file, each request gets its own + profile. The file names are in the format ..prof where is + the request path with "/" replaced by ".", and is a timestamp with + microseconds to prevent overwriting files. + + Use the gather_profile_stats.py script to gather these individual request + profiles into aggregated profiles by request path. + ''' + profname = "%s.%.3f.prof" % (req.uri.strip("/").replace('/', '.'), time.time()) + profname = os.path.join(PROFILE_DATA_DIR, profname) + prof = hotshot.Profile(profname) + return prof.runcall(ModPythonHandler(), req) -- cgit v1.3