From 83aae3ca3bc362681f1b3e753d28a13d49aca842 Mon Sep 17 00:00:00 2001 From: Miquel Torres Date: Tue, 11 Jan 2011 19:33:18 +0100 Subject: [PATCH] Make change and trend thresholds configurable in settings.py Comparison view: Don't render legend off plot area when there is only one bar --- speedcenter/codespeed/settings.py | 7 +++++++ speedcenter/codespeed/views.py | 5 +++++ speedcenter/media/css/main.css | 2 +- speedcenter/media/js/codespeed.js | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/speedcenter/codespeed/settings.py b/speedcenter/codespeed/settings.py index 4f5ac82f..32481c0b 100644 --- a/speedcenter/codespeed/settings.py +++ b/speedcenter/codespeed/settings.py @@ -7,6 +7,13 @@ # Given as the name of the executable and commitid of the revision # Example: defaultbaseline = {'executable': 'myexe', 'revision': '21'} +# Threshold that determines when a performance change over the last result is significant +changethreshold = 3.0 + +# Threshold that determines when a performance change +# over a number of revisions is significant +trendthreshold = 3.0 + # Changes view options ## defaultexecutable = None # Executable that should be chosen as default in the changes view # Given as the id of the executable. diff --git a/speedcenter/codespeed/views.py b/speedcenter/codespeed/views.py index 5fb0da01..7ca28dba 100644 --- a/speedcenter/codespeed/views.py +++ b/speedcenter/codespeed/views.py @@ -589,6 +589,11 @@ def changes(request): # Configuration of default parameters defaultchangethres = 3 defaulttrendthres = 3 + if hasattr(settings, 'changethreshold') and settings.changethreshold != None: + defaultchangethres = settings.changethreshold + if hasattr(settings, 'trendthreshold') and settings.trendthreshold != None: + defaulttrendthres = settings.trendthreshold + defaulttrend = 10 trends = [5, 10, 20, 50, 100] if 'tre' in data and int(data['tre']) in trends: diff --git a/speedcenter/media/css/main.css b/speedcenter/media/css/main.css index 91d79b83..7188e3fb 100644 --- a/speedcenter/media/css/main.css +++ b/speedcenter/media/css/main.css @@ -234,7 +234,7 @@ div#contentwrap div div { display: block; } @media only screen and (max-width:1010px) { div#contentwrap div { display: table-row!important; } table.info { margin-bottom: 0.8em; } - div#title { margin-bottom: -37px; background-color: transparent; } + div#title { margin-bottom: -35px; background-color: transparent; } div#title h2 { margin-top: 0.1em; margin-right: 2px; font-size: 90%; float: none; } div#title ul { position: absolute; diff --git a/speedcenter/media/js/codespeed.js b/speedcenter/media/js/codespeed.js index 52c21e5a..8e05ebd6 100644 --- a/speedcenter/media/js/codespeed.js +++ b/speedcenter/media/js/codespeed.js @@ -307,7 +307,7 @@ function renderComparisonPlot(plotid, benchmarks, exes, enviros, baseline, chart // determine conditions for rendering the legend outside the plot area var offplot = false; - if (!horizontal && (series.length > 4 || ticks.length == 1)) { offplot = true; } + if (!horizontal && series.length > 4) { offplot = true; } else if (horizontal && series.length > 2*ticks.length) { offplot = true; } if (offplot) {