Misc updates:
* adjust the timers to take a tag on the start; this allows them to be started/stopped independently, rather than needing to nest them * add a few timers to get some perf info * removed unused stuff: header_comment and html_link() * use request.amp_query for the tarball_href git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@413 8cb11bc2-c004-0410-86c3-e597b4017df7remotes/tags/V0_9
parent
1470ccd12f
commit
caf33e7862
11
lib/debug.py
11
lib/debug.py
|
@ -12,19 +12,22 @@
|
||||||
#
|
#
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
# Note: a t_start/t_end pair consumes about 0.00005 seconds on a P3/700.
|
||||||
|
# the lambda form (when debugging is disabled) should be even faster.
|
||||||
|
#
|
||||||
|
|
||||||
if 0:
|
if 0:
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
_stack = [ ]
|
_timers = { }
|
||||||
_times = { }
|
_times = { }
|
||||||
|
|
||||||
def t_start():
|
def t_start(which):
|
||||||
_stack.append(time.time())
|
_timers[which] = time.time()
|
||||||
|
|
||||||
def t_end(which):
|
def t_end(which):
|
||||||
t = time.time() - _stack.pop()
|
t = time.time() - _timers[which]
|
||||||
if _times.has_key(which):
|
if _times.has_key(which):
|
||||||
_times[which] = _times[which] + t
|
_times[which] = _times[which] + t
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -39,6 +39,11 @@ CONF_PATHNAME = None
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
|
# this comes from our library; measure the startup time
|
||||||
|
import debug
|
||||||
|
debug.t_start('startup')
|
||||||
|
debug.t_start('imports')
|
||||||
|
|
||||||
# standard modules that we know are in the path or builtin
|
# standard modules that we know are in the path or builtin
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
@ -56,9 +61,10 @@ import compat
|
||||||
import config
|
import config
|
||||||
import popen
|
import popen
|
||||||
import ezt
|
import ezt
|
||||||
import debug
|
|
||||||
import accept
|
import accept
|
||||||
|
|
||||||
|
debug.t_end('imports')
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
checkout_magic_path = '*checkout*'
|
checkout_magic_path = '*checkout*'
|
||||||
|
@ -91,12 +97,6 @@ _FILE_HAD_ERROR = 'could not read file'
|
||||||
|
|
||||||
_UNREADABLE_MARKER = '//UNREADABLE-MARKER//'
|
_UNREADABLE_MARKER = '//UNREADABLE-MARKER//'
|
||||||
|
|
||||||
header_comment = '''\
|
|
||||||
<!-- ViewCVS -- http://viewcvs.sourceforge.net/
|
|
||||||
by Greg Stein -- mailto:gstein@lyra.org
|
|
||||||
-->
|
|
||||||
'''
|
|
||||||
|
|
||||||
# for reading/writing between a couple descriptors
|
# for reading/writing between a couple descriptors
|
||||||
CHUNK_SIZE = 8192
|
CHUNK_SIZE = 8192
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ def generate_page(request, tname, data):
|
||||||
else:
|
else:
|
||||||
tname = string.replace(tname, '%lang%', 'en')
|
tname = string.replace(tname, '%lang%', 'en')
|
||||||
|
|
||||||
debug.t_start()
|
debug.t_start('ezt-parse')
|
||||||
template = ezt.Template(os.path.join(g_install_dir, tname))
|
template = ezt.Template(os.path.join(g_install_dir, tname))
|
||||||
debug.t_end('ezt-parse')
|
debug.t_end('ezt-parse')
|
||||||
|
|
||||||
|
@ -333,9 +333,6 @@ def clickable_path(request, path, leaf_is_link, leaf_is_file, drop_leaf):
|
||||||
|
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def html_link(contents, link):
|
|
||||||
return '<a href="%s">%s</a>' % (link, contents)
|
|
||||||
|
|
||||||
def prep_tags(query_dict, file_url, tags):
|
def prep_tags(query_dict, file_url, tags):
|
||||||
links = [ ]
|
links = [ ]
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
|
@ -1415,10 +1412,7 @@ def view_directory(request):
|
||||||
tar_basename = os.path.basename(where)
|
tar_basename = os.path.basename(where)
|
||||||
if not tar_basename:
|
if not tar_basename:
|
||||||
tar_basename = "cvs_root"
|
tar_basename = "cvs_root"
|
||||||
url = tar_basename + '.tar.gz?tarball=1'
|
url = tar_basename + '.tar.gz?tarball=1' + request.amp_query
|
||||||
query = sticky_query(query_dict)
|
|
||||||
if query:
|
|
||||||
url = url + '&' + query
|
|
||||||
data['tarball_href'] = url
|
data['tarball_href'] = url
|
||||||
|
|
||||||
http_header()
|
http_header()
|
||||||
|
@ -2523,6 +2517,7 @@ def download_tarball(request):
|
||||||
fp.close()
|
fp.close()
|
||||||
|
|
||||||
def handle_config():
|
def handle_config():
|
||||||
|
debug.t_start('load-config')
|
||||||
global cfg
|
global cfg
|
||||||
if cfg is None:
|
if cfg is None:
|
||||||
cfg = config.Config()
|
cfg = config.Config()
|
||||||
|
@ -2542,6 +2537,8 @@ def handle_config():
|
||||||
"search": None,
|
"search": None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug.t_end('load-config')
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# handle the configuration stuff
|
# handle the configuration stuff
|
||||||
|
@ -2550,6 +2547,9 @@ def main():
|
||||||
# build a Request object, which contains info about the HTTP request
|
# build a Request object, which contains info about the HTTP request
|
||||||
request = Request()
|
request = Request()
|
||||||
|
|
||||||
|
# most of the startup is done now.
|
||||||
|
debug.t_end('startup')
|
||||||
|
|
||||||
# is the CVS root really there?
|
# is the CVS root really there?
|
||||||
if not os.path.isdir(request.cvsroot):
|
if not os.path.isdir(request.cvsroot):
|
||||||
error('%s not found!\nThe server on which the CVS tree lives is '
|
error('%s not found!\nThe server on which the CVS tree lives is '
|
||||||
|
@ -2618,7 +2618,7 @@ def main():
|
||||||
|
|
||||||
def run_cgi():
|
def run_cgi():
|
||||||
try:
|
try:
|
||||||
debug.t_start()
|
debug.t_start('main')
|
||||||
main()
|
main()
|
||||||
debug.t_end('main')
|
debug.t_end('main')
|
||||||
debug.dump()
|
debug.dump()
|
||||||
|
|
Loading…
Reference in New Issue