Skip to content

Commit

Permalink
Limit horizontal plot height to avoid eating up all memory
Browse files Browse the repository at this point in the history
Timeline: benchmark description now fades out together with the plot
Tidy up some code
  • Loading branch information
tobami committed Jan 2, 2011
1 parent 311b544 commit 11fa22a
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 22 deletions.
8 changes: 3 additions & 5 deletions speedcenter/codespeed/mercurial.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ def getlogs(endrev, startrev):
date = datetime.datetime.fromtimestamp(float(date)).strftime("%Y-%m-%d %H:%M:%S")

# Add changeset info
logs.append({'date': date, 'author': author, 'message': message,
'commitid': commitid})
# Remove last log because the startrev log shouldn't be shown
if len(logs) > 1:
logs.pop()
logs.append({
'date': date, 'author': author,
'message': message,'commitid': commitid})
return logs
14 changes: 8 additions & 6 deletions speedcenter/codespeed/settings.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# -*- coding: utf-8 -*-
## General default options ##
defaultexecutable = None # Executable that should be chosen as default in the changes view
# Given as the id of the executable.
# Example: defaultexecutable = "myexe"
defaultenvironment = None #Name of the environment which should be selected as default


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

defaultenvironment = None #Name of the environment which should be selected as default

# Changes view options ##
defaultexecutable = None # Executable that should be chosen as default in the changes view
# Given as the id of the executable.
# Example: defaultexecutable = "myexe"

## Comparison view options ##
charttype = 'normal bars' # The options are 'normal bars', 'stacked bars' and 'relative bars'
Expand All @@ -18,4 +20,4 @@
# chosen in the defaultbaseline setting

chartorientation = 'vertical' # 'vertical' or 'horizontal can be chosen as
# default chart orientation
# default chart orientation
7 changes: 3 additions & 4 deletions speedcenter/codespeed/subversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ def get_login(realm, username, may_save):
date = datetime.fromtimestamp(log.date).strftime("%Y-%m-%d %H:%M:%S")
message = log.message
# Add log unless it is the last commit log, which has already been tested
if not (startrev != newrev and log.revision.number == int(startrev.commitid)):
logs.append(
{'date': date, 'author': author, 'message': message,
'commitid': log.revision.number})
logs.append({
'date': date, 'author': author, 'message': message,
'commitid': log.revision.number})
return logs
4 changes: 3 additions & 1 deletion speedcenter/codespeed/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,9 @@ def getcommitlogs(rev, startrev, update=False):
if resp.get('error'):
return resp
logs = getlogs(rev, startrev)

# Remove last log because the startrev log shouldn't be shown
if len(logs) > 1 and logs[-1].get('commitid') == startrev.commitid:
logs.pop()
return logs

def saverevisioninfo(rev):
Expand Down
8 changes: 5 additions & 3 deletions speedcenter/media/js/codespeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,17 @@ function renderComparisonPlot(plotid, benchmarks, exes, enviros, baseline, chart
// Not good when there is a 0 bar. It even shows negative bars when all bars are 0
}

//determine optimal height
// Determine optimal height
if (chart =="stacked bars") {
h = 90 + ticks.length * (plotoptions.seriesDefaults.rendererOptions.barPadding*2 + barWidth);
} else {
h = barcounter * (plotoptions.seriesDefaults.rendererOptions.barPadding*2 + barWidth) + benchcounter * plotoptions.seriesDefaults.rendererOptions.barMargin * 2;
}

if (h > 820) {
// Adjust plot height
if (h > 700) {
h = h/2;
if (h < 700) { h = 700; }
else if (h > 2000) { h = 2000; }
plotoptions.seriesDefaults.rendererOptions.barPadding = 0;
plotoptions.seriesDefaults.rendererOptions.barMargin = 8;
plotoptions.seriesDefaults.shadow = false;
Expand Down
2 changes: 1 addition & 1 deletion speedcenter/templates/codespeed/comparison.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
$("#plotwrapper").html(msg);
return false;
} else if (conf['chart'] == "stacked bars" && conf['bas'] != "none") {
msg = '<p class="warning">Normalized stacked bars actually represent the weighted arithmetic sum. Choosing different weightings from the "Normalization" menu will change the totals relative to one another. For the correct way to calculate total bars, the geometric mean must be used (see <a href="http://portal.acm.org/citation.cfm?id=5666.5673 " title="How not to lie with statistics: the correct way to summarize benchmark results">paper</a>)</p>';
msg = '<p class="warning">Normalized stacked bars actually represent the weighted arithmetic sum, useful to spot which individual benchmarks take up the most time. Choosing different weightings from the "Normalization" menu will change the totals relative to one another. For the correct way to calculate total bars, the geometric mean must be used (see <a href="http://portal.acm.org/citation.cfm?id=5666.5673 " title="How not to lie with statistics: the correct way to summarize benchmark results">paper</a>)</p>';
}

$("#plotwrapper").fadeOut("fast", function() {
Expand Down
3 changes: 1 addition & 2 deletions speedcenter/templates/codespeed/timeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
}
}

$("#plotgrid").html('<div id="plot"></div>');
$("#plotgrid").html('<div id="plot"></div><div id="plotdescription"></div>');

if (data['benchmark_description']) {
$("#plotdescription").html('<p class="note">Benchmark description: ' + data['benchmark_description'] + '</p>');
Expand Down Expand Up @@ -199,7 +199,6 @@

function refreshContent() {
var h = parseInt($("#content").css("height"));//get height for loading text
$("#plotdescription").html('');
$("#plotgrid").fadeOut("fast", function() {
$("#plotgrid").html(getLoadText("Loading...", h, true)).show();
$.getJSON("json/", getConfiguration(), render);
Expand Down

0 comments on commit 11fa22a

Please sign in to comment.