Changeset 168
- Timestamp:
- 07/18/05 01:10:00 (3 years ago)
- Files:
-
- django/trunk/django/bin/profiling/handler.py (modified) (3 diffs)
- django/trunk/django/core/handler.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/bin/profiling/handler.py
r3 r168 1 1 import hotshot, time, os 2 from django.core.handler import CoreHandler2 from django.core.handler import ModPythonHandler 3 3 4 4 PROFILE_DATA_DIR = "/var/log/cmsprofile/" … … 7 7 ''' 8 8 Handler that uses hotshot to store profile data. 9 9 10 10 Stores profile data in PROFILE_DATA_DIR. Since hotshot has no way (that I 11 11 know of) to append profile data to a single file, each request gets its own … … 13 13 the request path with "/" replaced by ".", and <n> is a timestamp with 14 14 microseconds to prevent overwriting files. 15 15 16 16 Use the gather_profile_stats.py script to gather these individual request 17 profiles into aggregated profiles by request path. 17 profiles into aggregated profiles by request path. 18 18 ''' 19 19 profname = "%s.%.3f.prof" % (req.uri.strip("/").replace('/', '.'), time.time()) 20 20 profname = os.path.join(PROFILE_DATA_DIR, profname) 21 21 prof = hotshot.Profile(profname) 22 return prof.runcall( CoreHandler(), req)22 return prof.runcall(ModPythonHandler(), req) django/trunk/django/core/handler.py
r167 r168 3 3 4 4 # NOTE: do *not* import settings (or any module which eventually imports 5 # settings) until after CoreHandler has been called; otherwise os.environ5 # settings) until after ModPythonHandler has been called; otherwise os.environ 6 6 # won't be set up correctly (with respect to settings). 7 7 8 class CoreHandler:8 class ModPythonHandler: 9 9 10 10 def __init__(self): … … 148 148 149 149 def handler(req): 150 return CoreHandler()(req)150 return ModPythonHandler()(req)
