summaryrefslogtreecommitdiffstats
path: root/src/bmserver
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2010-03-19 14:44:46 +0100
committerjasplin <qt-info@nokia.com>2010-03-19 14:44:46 +0100
commit22807b3aaf4f1bb07a088124c50f6d8900a2fb72 (patch)
tree00c978f4e34b6c0c8008bb3d92cd8a88d8a1c06b /src/bmserver
parent849c7453ea6e12a896d56d32f6226397100bb1f3 (diff)
Moved timestamp from snapshot to result.
This patch moves the timestamp attribute from the snapshot table to the result table. This is done for two purposes: 1) Retrieving a pure result history (not including the SHA-1 values) becomes quicker, since a join is avoided (simply fetch all (timestamp, value) pairs matching a given BM context). 2) It constitutes the first of two steps towards supporting multiple result recordings per (SHA-1, BM context) combination (the other step will be to remove the current uniqueness constraint on that combination!). The (future) use case is to improve statistical confidence by e.g. taking the median value of the set of values for a certain (SHA-1, BM context) combination as the representative value for the combination.
Diffstat (limited to 'src/bmserver')
-rw-r--r--src/bmserver/main.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/bmserver/main.cpp b/src/bmserver/main.cpp
index 8dc6a20..7da8be0 100644
--- a/src/bmserver/main.cpp
+++ b/src/bmserver/main.cpp
@@ -103,7 +103,7 @@ static bool initDatabase(const QString &dbfile, QString *error)
// snapshot
ok = query.exec(
"CREATE TABLE snapshot(id INTEGER PRIMARY KEY AUTOINCREMENT"
- ", sha1 TEXT NOT NULL, timestamp INTEGER NOT NULL"
+ ", sha1 TEXT NOT NULL"
", UNIQUE(sha1));");
Q_ASSERT(ok);
@@ -112,6 +112,7 @@ static bool initDatabase(const QString &dbfile, QString *error)
"CREATE TABLE result(id INTEGER PRIMARY KEY AUTOINCREMENT"
", bmcontextId INTEGER REFERENCES bmcontext(id)"
", snapshotId INTEGER REFERENCES snapshot(id)"
+ ", timestamp INTEGER NOT NULL"
", value REAL NOT NULL"
", UNIQUE(bmcontextId, snapshotId));");
Q_ASSERT(ok);
@@ -166,15 +167,15 @@ static bool initDatabase(const QString &dbfile, QString *error)
ok = query.exec("CREATE INDEX index_bmcontext_all ON bmcontext(contextId, benchmarkId);");
Q_ASSERT(ok);
- ok = query.exec("CREATE INDEX index_snapshot_timestamp ON snapshot(timestamp);");
- Q_ASSERT(ok);
-
ok = query.exec("CREATE INDEX index_result_snapshotId ON result(snapshotId);");
Q_ASSERT(ok);
ok = query.exec("CREATE INDEX index_result_bmcontextId ON result(bmcontextId);");
Q_ASSERT(ok);
+ ok = query.exec("CREATE INDEX index_result_timestamp ON result(timestamp);");
+ Q_ASSERT(ok);
+
ok = query.exec("CREATE INDEX index_result_all ON result(snapshotId, bmcontextId);");
Q_ASSERT(ok);