summaryrefslogtreecommitdiffstats
path: root/src/bmserver
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2009-12-14 13:54:38 +0100
committerjasplin <qt-info@nokia.com>2009-12-14 13:54:38 +0100
commite2aa74dab12688af125a380b6576df6fa5f61bf7 (patch)
tree731342663f4bc9f655f1aa444d1e043ef118e217 /src/bmserver
parent8d0ad9b98fbbb3e09721ce4b107623ea5cbe81e9 (diff)
Obsoleted 'iterations' and added DB indexes.
The most important change of this commit is that the 'iterations' component of the result value is gone. Now the result value represented by just the final real-valued result, rather than two integer components: (accumulated) result and number of iterations. NOTE: The old file format is still accepted, and when an iterations component is present, the result component will be divided by this one. The other significant change of this commit is that indexes are added to the database scheme to speed up queries. This only affects the 'initdb' command-line option, though.
Diffstat (limited to 'src/bmserver')
-rw-r--r--src/bmserver/main.cpp43
1 files changed, 41 insertions, 2 deletions
diff --git a/src/bmserver/main.cpp b/src/bmserver/main.cpp
index 21aafdc..3f22b2f 100644
--- a/src/bmserver/main.cpp
+++ b/src/bmserver/main.cpp
@@ -44,6 +44,7 @@ static bool initDatabase(const QString &dbfile, QString *error)
bool ok;
+
// *** Create tables ***
// benchmark
@@ -97,11 +98,49 @@ static bool initDatabase(const QString &dbfile, QString *error)
", hostId INTEGER REFERENCES host(id)"
", branchId INTEGER REFERENCES branch(id)"
", snapshotId INTEGER REFERENCES snapshot(id)"
- ", value BIGINT NOT NULL"
- ", iterations BIGINT NOT NULL"
+ ", value REAL NOT NULL"
", UNIQUE(benchmarkId, metricId, platformId, hostId, branchId, snapshotId));");
Q_ASSERT(ok);
+
+ // *** Create indexes ***
+ ok = query.exec("CREATE INDEX index_result_benchmarkId ON result(benchmarkId);");
+ Q_ASSERT(ok);
+
+ ok = query.exec("CREATE INDEX index_result_metricId ON result(metricId);");
+ Q_ASSERT(ok);
+
+ ok = query.exec("CREATE INDEX index_result_platformId ON result(platformId);");
+ Q_ASSERT(ok);
+
+ ok = query.exec("CREATE INDEX index_result_hostId ON result(hostId);");
+ Q_ASSERT(ok);
+
+ ok = query.exec("CREATE INDEX index_result_branchId ON result(branchId);");
+ Q_ASSERT(ok);
+
+ ok = query.exec("CREATE INDEX index_result_snapshotId ON result(snapshotId);");
+ Q_ASSERT(ok);
+
+ ok = query.exec(
+ "CREATE INDEX index_benchmark_name ON benchmark(testCase, testFunction, dataTag);");
+ Q_ASSERT(ok);
+
+ ok = query.exec("CREATE INDEX index_metric_name ON metric(name);");
+ Q_ASSERT(ok);
+
+ ok = query.exec("CREATE INDEX index_platform_name ON platform(name);");
+ Q_ASSERT(ok);
+
+ ok = query.exec("CREATE INDEX index_host_name ON host(name);");
+ Q_ASSERT(ok);
+
+ ok = query.exec("CREATE INDEX index_branch_name ON branch(gitRepo, gitBranch);");
+ Q_ASSERT(ok);
+
+ ok = query.exec("CREATE INDEX index_snapshot_timestamp ON snapshot(timestamp);");
+ Q_ASSERT(ok);
+
return true;
}