Skip to content

Commit

Permalink
Allow to select default checked executables in the comparison view
Browse files Browse the repository at this point in the history
  • Loading branch information
tobami committed Jan 11, 2011
1 parent 6c08115 commit 50c2a0f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Codespeed
A web application to monitor and analyze the performance of your code.

It is known to be used by [PyPy](speed.pypy.org) and [Twisted](speed.twistedmatrix.com).

# Requirements
You will need Python 2.6+ and Django 1.1+.

Expand Down
12 changes: 11 additions & 1 deletion speedcenter/codespeed/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


defaultbaseline = None # Which executable + revision should be default as a baseline
# Given as the id of the executable + commitid of the revision
# Given as the name of the executable and commitid of the revision
# Example: defaultbaseline = {'executable': 'myexe', 'revision': '21'}

# Changes view options ##
Expand All @@ -21,3 +21,13 @@

chartorientation = 'vertical' # 'vertical' or 'horizontal can be chosen as
# default chart orientation

comp_defaultexecutables = None # Which executable + revision should be checked
# Given as a list of tuples containing the
# name of an executable + commitid of a revision
# An 'L' denotes the last revision
# Example:
# comp_defaultexecutables = [
# ('myexe', '21df2423ra'),
# ('myexe', 'L'),
#]
28 changes: 27 additions & 1 deletion speedcenter/codespeed/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,29 @@ def comparison(request):
if not i: continue
if i in exekeys:
checkedexecutables.append(i)
elif hasattr(settings, 'comp_defaultexecutables') and\
settings.comp_defaultexecutables != None:
for exe, rev in settings.comp_defaultexecutables:
try:
exe = Executable.objects.get(name=exe)
key = str(exe.id) + "+"
if rev == "L":
key += rev
else:
rev = Revision.objects.get(commitid=rev)
key += str(rev.id)
if key in exekeys:
checkedexecutables.append(key)
else:
#TODO: log
pass
except Executable.DoesNotExist:
#TODO: log
pass
except Revision.DoesNotExist:
#TODO: log
pass

if not checkedexecutables:
checkedexecutables = exekeys

Expand All @@ -186,7 +209,9 @@ def comparison(request):
bench_units = {}
for unit in units_titles:
# Only include benchmarks marked as cross-project
benchmarks[unit] = Benchmark.objects.filter(benchmark_type="C").filter(units_title=unit)
benchmarks[unit] = Benchmark.objects.filter(
benchmark_type="C"
).filter(units_title=unit)
units = benchmarks[unit][0].units
lessisbetter = benchmarks[unit][0].lessisbetter and ' (less is better)' or ' (more is better)'
bench_units[unit] = [[b.id for b in benchmarks[unit]], lessisbetter, units]
Expand Down Expand Up @@ -360,6 +385,7 @@ def timeline(request):
checkedexecutables.append(Executable.objects.get(id=int(i)))
except Executable.DoesNotExist:
pass

if not checkedexecutables:
checkedexecutables = Executable.objects.filter(project__track=True)

Expand Down

0 comments on commit 50c2a0f

Please sign in to comment.