summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2011-02-16 21:31:26 +0100
committerjasplin <qt-info@nokia.com>2011-02-16 21:31:26 +0100
commit7a6fe7ee8739611bc6ea7fa7be86abc3fd76c591 (patch)
treefba78adb584a97f68db03177ed4b047034b6b05c
parent377d36887db522ceee0a4b8866a76517d1d64903 (diff)
Use infinite endpoint for snapshot interval in single time series URL.
The URL that refers to a single time series now specifies an infinite enpoint for the second snapshot (by specifying an invalid SHA-1). Reloading the page is then guaranteed to show the latest available results, This is likely to be more useful in practice.
-rw-r--r--scripts/misc.py36
-rw-r--r--web/getstats/tsbmbody.html7
-rw-r--r--web/getstats/tsbmbody.js2
3 files changed, 32 insertions, 13 deletions
diff --git a/scripts/misc.py b/scripts/misc.py
index a2e8ffd..8bad9a1 100644
--- a/scripts/misc.py
+++ b/scripts/misc.py
@@ -89,7 +89,9 @@ def getTimestampFromContext(context_id):
# Finds snapshots that match a host/platform/branch combination and that
-# lie within the [sha11, sha12] range.
+# lie within the range
+# [sha11, sha12] if sha12_id >= 0, or
+# [sha11, +inf) if sha12_ is < 0.
# Returns a chronologically order n-tuple of 2-tuples:
# (sha1, first upload timestamp).
def getSnapshots(host_id, platform_id, branch_id, sha11_id, sha12_id):
@@ -100,16 +102,26 @@ def getSnapshots(host_id, platform_id, branch_id, sha11_id, sha12_id):
" AND branchId = " + str(branch_id) +
" AND sha1Id = " + str(sha11_id) + ";")[0][0]
- timestamp2 = execQuery(
- "SELECT EXTRACT(EPOCH FROM timestamp)::INT FROM context " +
- "WHERE hostId = " + str(host_id) +
- " AND platformId = " + str(platform_id) +
- " AND branchId = " + str(branch_id) +
- " AND sha1Id = " + str(sha12_id) + ";")[0][0]
+ if sha12_id >= 0:
+
+ timestamp2 = execQuery(
+ "SELECT EXTRACT(EPOCH FROM timestamp)::INT FROM context " +
+ "WHERE hostId = " + str(host_id) +
+ " AND platformId = " + str(platform_id) +
+ " AND branchId = " + str(branch_id) +
+ " AND sha1Id = " + str(sha12_id) + ";")[0][0]
+
+ # Ensure chronological order:
+ if timestamp1 > timestamp2:
+ timestamp1, timestamp2 = timestamp2, timestamp1
+
+ range_expr = "BETWEEN %d AND %d" % (timestamp1, timestamp2)
+
+ else:
+
+ range_expr = ">= %d" % timestamp1
+
- # Ensure chronological order:
- if timestamp1 > timestamp2:
- timestamp1, timestamp2 = timestamp2, timestamp1
# Each distinct SHA-1 that occurs for this host/platform/branch
# combination may occur multiple times with different upload times.
@@ -123,9 +135,9 @@ def getSnapshots(host_id, platform_id, branch_id, sha11_id, sha12_id):
"WHERE hostId = %d"
" AND platformId = %d"
" AND branchId = %d"
- " AND EXTRACT(EPOCH FROM timestamp)::INT BETWEEN %d AND %d"
+ " AND EXTRACT(EPOCH FROM timestamp)::INT %s"
" ORDER BY timestamp ASC;"
- % (host_id, platform_id, branch_id, timestamp1, timestamp2))
+ % (host_id, platform_id, branch_id, range_expr))
return tuple(snapshots)
diff --git a/web/getstats/tsbmbody.html b/web/getstats/tsbmbody.html
index a4e91e2..69fed8d 100644
--- a/web/getstats/tsbmbody.html
+++ b/web/getstats/tsbmbody.html
@@ -295,6 +295,13 @@
<span style="text-align:left">
<a id="url_tsbm" onclick="return false"
href="javascript::void(0)">URL</a>
+ <script type="text/javascript">
+ setTooltip(
+ $("#url_tsbm"),
+ "Link to page with details for this time series.<br /><br />" +
+ "<b>Note:</b> Reloading that page will reflect the most" +
+ " recent results in the database.")
+ </script>
</span>
</div>
</td>
diff --git a/web/getstats/tsbmbody.js b/web/getstats/tsbmbody.js
index 85354c3..541fcd1 100644
--- a/web/getstats/tsbmbody.js
+++ b/web/getstats/tsbmbody.js
@@ -1225,7 +1225,7 @@ function enableTSBMURL(
query += "&platform=" + encodeURIComponent(platform);
query += "&branch=" + encodeURIComponent(branch);
query += "&sha11=" + sha11;
- query += "&sha12=" + sha12;
+ query += "&sha12=latest"; // invalid SHA-1 specifies infinite endpoint
query += "&benchmark=" + encodeURIComponent(benchmark);
query += "&metric=" + encodeURIComponent(metric);
query += "&difftol=" + difftol;