-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed django.core.handler.CoreHandler to ModPythonHandler, in prepa…
…ration for WSGI support git-svn-id: http://code.djangoproject.com/svn/django/trunk@168 bcc190cf-cafb-0310-a4f2-bffc1f526a37
- Loading branch information
1 parent
feeeda9
commit 4e094e2
Showing
2 changed files
with
8 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import hotshot, time, os | ||
from django.core.handler import CoreHandler | ||
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 <url>.<n>.prof where <url> is | ||
the request path with "/" replaced by ".", and <n> 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. | ||
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(CoreHandler(), req) | ||
return prof.runcall(ModPythonHandler(), req) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters