mirror of
https://github.com/django/django.git
synced 2024-12-24 10:05:46 +00:00
[1.8.x] Removed gather_profile_stats.py
This script uses the unmaintained hotshot module (gone on Python 3)
and doesn't seem to be Django specific in any way.
Backport of 388d986b8a
from master
This commit is contained in:
parent
5bc9904b35
commit
6adc23d6b6
@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
gather_profile_stats.py /path/to/dir/of/profiles
|
||||
|
||||
Note that the aggregated profiles must be read with pstats.Stats, not
|
||||
hotshot.stats (the formats are incompatible)
|
||||
"""
|
||||
|
||||
from hotshot import stats
|
||||
import os
|
||||
import pstats
|
||||
import sys
|
||||
|
||||
|
||||
def gather_stats(p):
|
||||
profiles = {}
|
||||
for f in os.listdir(p):
|
||||
if f.endswith('.agg.prof'):
|
||||
path = f[:-9]
|
||||
prof = pstats.Stats(os.path.join(p, f))
|
||||
elif f.endswith('.prof'):
|
||||
bits = f.split('.')
|
||||
path = ".".join(bits[:-3])
|
||||
prof = stats.load(os.path.join(p, f))
|
||||
else:
|
||||
continue
|
||||
print("Processing %s" % f)
|
||||
if path in profiles:
|
||||
profiles[path].add(prof)
|
||||
else:
|
||||
profiles[path] = prof
|
||||
os.unlink(os.path.join(p, f))
|
||||
for (path, prof) in profiles.items():
|
||||
prof.dump_stats(os.path.join(p, "%s.agg.prof" % path))
|
||||
|
||||
if __name__ == '__main__':
|
||||
gather_stats(sys.argv[1])
|
@ -1,26 +0,0 @@
|
||||
.TH "gather_profile_stats.py" "1" "August 2007" "Django Project" ""
|
||||
.SH "NAME"
|
||||
gather_profile_stats.py \- Performance analysis tool for the Django Web
|
||||
framework
|
||||
.SH "SYNOPSIS"
|
||||
.B python gather_profile_stats.py
|
||||
.I <path>
|
||||
|
||||
.SH "DESCRIPTION"
|
||||
This utility script aggregates profiling logs generated using Python's
|
||||
hotshot profiler. The sole command-line argument is the full path to the
|
||||
directory containing the profiling logfiles.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
Discussion of profiling Django applications on the Django project's wiki:
|
||||
.sp
|
||||
.I https://www.djangoproject.com/wiki/ProfilingDjango
|
||||
|
||||
.SH "AUTHORS/CREDITS"
|
||||
Originally developed at World Online in Lawrence, Kansas, USA. Refer to the
|
||||
AUTHORS file in the Django distribution for contributors.
|
||||
|
||||
.SH "LICENSE"
|
||||
New BSD license. For the full license text refer to the LICENSE file in the
|
||||
Django distribution.
|
||||
|
Loading…
Reference in New Issue
Block a user