summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2010-05-04 08:31:29 +0200
committerjasplin <qt-info@nokia.com>2010-05-04 08:31:29 +0200
commit0cb9c0f14582a6e91d44765748154906e75e9baa (patch)
tree72f2fa5222f8fd9feb28b53294cd6c38c8be6763
parent987673cab99f1bbbea98b7df3fe3a207110390b4 (diff)
Prepare data quality stats feature.
-rw-r--r--src/bm/bmrequest.cpp21
-rw-r--r--src/bm/bmrequest.h8
-rw-r--r--src/bm/index.cpp31
-rw-r--r--src/bmclient/main.cpp45
-rw-r--r--src/bmweb/indexsection.js76
-rw-r--r--src/bmweb/style.css15
6 files changed, 153 insertions, 43 deletions
diff --git a/src/bm/bmrequest.cpp b/src/bm/bmrequest.cpp
index 9300dc3..5f008b4 100644
--- a/src/bm/bmrequest.cpp
+++ b/src/bm/bmrequest.cpp
@@ -4848,8 +4848,15 @@ QByteArray BMRequest_IndexGetValues::toRequestBuffer(QString *)
QString request =
QString(
"<request type=\"%1\"><args baseTimestamp=\"%2\" medianWinSize=\"%3\" "
- "cacheKey=\"%4\" />")
- .arg(name()).arg(baseTimestamp).arg(medianWinSize).arg(cacheKey);
+ "cacheKey=\"%4\" dataQualityStats=\"%5\" dqStatsDiffTol=\"%6\" "
+ "dqStatsStabTol=\"%7\" />")
+ .arg(name())
+ .arg(baseTimestamp)
+ .arg(medianWinSize)
+ .arg(cacheKey)
+ .arg(dataQualityStats ? 1 : 0)
+ .arg(dqStatsDiffTol)
+ .arg(dqStatsStabTol);
for (int i = 0; i < testCaseFilter.size(); ++i)
request += QString("<testCase name=\"%1\" />").arg(testCaseFilter.at(i));
@@ -4911,6 +4918,14 @@ QByteArray BMRequest_IndexGetValues::toReplyBuffer()
medianWinSize = argsElem.attributeNode("medianWinSize").value().toInt(&ok);
Q_ASSERT(ok);
+ // Get data quality stats params ...
+ dataQualityStats = argsElem.attributeNode("dataQualityStats").value().toInt(&ok);
+ Q_ASSERT(ok);
+ dqStatsDiffTol = argsElem.attributeNode("dqStatsDiffTol").value().toDouble(&ok);
+ Q_ASSERT(ok);
+ dqStatsStabTol = argsElem.attributeNode("dqStatsStabTol").value().toInt(&ok);
+ Q_ASSERT(ok);
+
// Get filters ...
QDomNodeList testCaseNodes = doc.elementsByTagName("testCase");
for (int i = 0; i < testCaseNodes.size(); ++i)
@@ -5085,7 +5100,7 @@ QByteArray BMRequest_IndexGetValues::toReplyBuffer()
QList<qreal> indexValues;
QList<int> contrCounts;
- QList<QList<Index::RankedInfo> > topContr;
+ QList<QList<Index::RankedInfo> > topContr; // Top contributors for each index value
const int topContrLimit = 10; // ### hard-coded for now!
QString error_;
if (!index.computeValues(
diff --git a/src/bm/bmrequest.h b/src/bm/bmrequest.h
index 89c50f3..43accf9 100644
--- a/src/bm/bmrequest.h
+++ b/src/bm/bmrequest.h
@@ -568,10 +568,13 @@ public:
const int baseTimestamp, const int medianWinSize,
const QString &cacheKey, const QStringList &testCaseFilter,
const QStringList &metricFilter, const QStringList &platformFilter,
- const QStringList &hostFilter, const QStringList &branchFilter)
+ const QStringList &hostFilter, const QStringList &branchFilter,
+ const bool dataQualityStats, const qreal dqStatsDiffTol, const qreal dqStatsStabTol)
: baseTimestamp(baseTimestamp), medianWinSize(medianWinSize), cacheKey(cacheKey)
, testCaseFilter(testCaseFilter), metricFilter(metricFilter)
, platformFilter(platformFilter), hostFilter(hostFilter), branchFilter(branchFilter)
+ , dataQualityStats(dataQualityStats), dqStatsDiffTol(dqStatsDiffTol)
+ , dqStatsStabTol(dqStatsStabTol)
{}
BMRequest_IndexGetValues(const QDomDocument &doc) : BMRequest(doc) {}
@@ -584,6 +587,9 @@ private:
mutable QStringList platformFilter;
mutable QStringList hostFilter;
mutable QStringList branchFilter;
+ mutable bool dataQualityStats;
+ mutable qreal dqStatsDiffTol;
+ mutable qreal dqStatsStabTol;
QString name() const { return "IndexGetValues"; }
QByteArray toRequestBuffer(QString *error);
diff --git a/src/bm/index.cpp b/src/bm/index.cpp
index 6bc6c78..be29787 100644
--- a/src/bm/index.cpp
+++ b/src/bm/index.cpp
@@ -280,5 +280,36 @@ bool IndexAlgorithm1::computeValues(
}
}
+
+ const bool computeDataQualityStatistics = false; // 4 NOW
+ if (computeDataQualityStatistics) {
+ // Step 1: Compute the MaxESSTotalCount and MaxESSStableCount for each
+ // contributing RH (compute for the exact median-smoothed
+ // values that formed the basis for computing the index)
+ //
+ // Step 2: Compute the complete distribution of MaxESSTotalCount
+ // (note that the number of distinct counts are likely to be only a small
+ // fraction of the number of RHs):
+ //
+ // TC(c1) = <# of RHs with a MaxESSTotalCount of c1>
+ // TC(c2) = <# of RHs with a MaxESSTotalCount of c2>
+ // ...
+ // TC(cN) = <# of RHs with a MaxESSTotalCount of cN>
+ //
+ // (TC = Total Count, and N is number of distinct counts)
+ //
+ // Step 3: Compute the percentile distribution (for the 10 levels 10%, 20%, ..., 100%)
+ // of the SF (stability fraction) values (where the SF for a given
+ // RH is MaxESSStableCount / MaxESSTotalCount):
+ //
+ // SFP(100) = <the max SF value for the worst 100% of the RHs (i.e. all RHs!)>
+ // SFP(90) = <the max SF value for the worst 90% of the RHs>
+ // SFP(80) = <the max SF value for the worst 80% of the RHs>
+ // ...
+ // SFP(10) = <the max SF value for the worst 10% of the RHs>
+ //
+ // (SFP = Stability Fraction Percentile)
+ }
+
return true;
}
diff --git a/src/bmclient/main.cpp b/src/bmclient/main.cpp
index 738e734..da99f3c 100644
--- a/src/bmclient/main.cpp
+++ b/src/bmclient/main.cpp
@@ -1036,9 +1036,49 @@ BMRequest * Executor::createIndexGetValuesRequest(
if (!BMMisc::getMultiOption(args, "-branch", &branchFilter, error))
return 0;
+ // Get data quality stats params ...
+ bool dataQualityStats = false;
+ qreal dqStatsDiffTol = -1;
+ int dqStatsStabTol = -1;
+ if (BMMisc::hasOption(args, "-dataqualitystats")) {
+ dataQualityStats = true;
+
+ // Difference tolerance ...
+ if (BMMisc::getOption(args, "-dqstatsdifftol", &values, 1, 0, error)) {
+ bool ok;
+ dqStatsDiffTol = values.at(0).toDouble(&ok);
+ if (!ok) {
+ *error =
+ "failed to extract difference tolerance for data quality stats as a double";
+ return 0;
+ }
+ dqStatsDiffTol = qMax(dqStatsDiffTol, 0.0);
+ } else {
+ if (error->isEmpty())
+ *error = QString("-dqstatsdifftol option not found");
+ return 0;
+ }
+
+ // Stability tolerance ...
+ if (BMMisc::getOption(args, "-dqstatsstabtol", &values, 1, 0, error)) {
+ bool ok;
+ dqStatsStabTol = values.at(0).toInt(&ok);
+ if ((!ok) || (dqStatsStabTol < 2)) {
+ *error =
+ "failed to extract stabiliity tolerance for data quality stats as an "
+ "integer >= 2";
+ return 0;
+ }
+ } else {
+ if (error->isEmpty())
+ *error = QString("-dqstatsstabtol option not found");
+ return 0;
+ }
+ }
+
return new BMRequest_IndexGetValues(
baseTimestamp, medianWinSize, cacheKey, testCaseFilter, metricFilter, platformFilter,
- hostFilter, branchFilter);
+ hostFilter, branchFilter, dataQualityStats, dqStatsDiffTol, dqStatsStabTol);
}
BMRequest * Executor::createIndexPutConfigRequest(const QStringList &args, QString *error) const
@@ -1582,7 +1622,8 @@ class DirectExecutor : public Executor
" -basetimestamp <...> [-medianwinsize <...> (default = 8)] \\\n"
" [-testcase <...> -testcase <...> ...] [-metric <...> -metric <...> ...] \\\n"
" [-platform <...> -platform <...> ...] [-host <...> -host <...> ...] \\\n"
- " [-branch <...> -branch <...> ...]\n"
+ " [-branch <...> -branch <...> ...] \\\n"
+ " [-dataqualitystats -dqstatsdifftol <...>] \n"
<<
"index get plot <SAME AS 'index get values' except that the optional \\\n"
diff --git a/src/bmweb/indexsection.js b/src/bmweb/indexsection.js
index c3fac25..05d15d3 100644
--- a/src/bmweb/indexsection.js
+++ b/src/bmweb/indexsection.js
@@ -69,6 +69,15 @@ function updateComputeIndexLink(defaultBaseTime, defaultMedianWinSize)
url += createFilterOptionsString("-host", getCheckedFilterValues("ixHostFilter"));
url += createFilterOptionsString("-branch", getCheckedFilterValues("ixBranchFilter"));
+
+ if (document.getElementById("ixDQStatsEnabled").checked) {
+ // Add parameters for data quality statistics ...
+ url += " -dataqualitystats"
+ + " -dqstatsdifftol " + document.getElementById("ixDQStatsDiffTol").value
+ + " -dqstatsstabtol " + selectedOptions("ixDQStatsStabTol")[0];
+ }
+
+
// Update link ...
link = document.getElementById("ixComputeIndexLink");
link.setAttribute("href", url);
@@ -537,14 +546,6 @@ function IndexSection()
table = section.appendChild(document.createElement("table"));
table.setAttribute("style", "border:0px; padding:0px");
tr = table.insertRow(0);
- td = tr.insertCell(0);
- td.setAttribute("style", "border:0px; padding:0px");
- linksFieldset = td.appendChild(document.createElement("fieldset"));
- linksFieldset.setAttribute("style", "border:0px; padding:2px");
-
- table = linksFieldset.appendChild(document.createElement("table"));
- table.setAttribute("style", "border:0px; padding:0px");
- tr = table.insertRow(0);
// ... 'compute index' link ...
td = tr.insertCell(tr.cells.length);
@@ -562,22 +563,51 @@ function IndexSection()
+ ")"
);
- // ... 'compute stats' link ...
+ // ... data quality stats fieldset ...
td = tr.insertCell(tr.cells.length);
- td.setAttribute("style", "border:0px; padding:2px");
- link = td.appendChild(document.createElement("a"));
- link.id = "ixComputeStatsLink";
- link.appendChild(document.createTextNode("Compute Stats"));
- link.setAttribute("class", "ixLink_stats");
- link.setAttribute("href", "dummy"); // for correct initial rendering
- link.setAttribute(
- "onmouseover",
- "updateComputeStatsLink("
- + defaultBaseTime
- + ", " + defaultMedianWinSize
- + ")"
- );
+ td.setAttribute("style", "border:0px; padding:0px");
+ fieldset = td.appendChild(document.createElement("fieldset"));
+ legend = fieldset.appendChild(document.createElement("legend"));
+ legend.appendChild(document.createTextNode("Data Quality Statistics"));
+ legend.setAttribute("style", "font-size:12");
+ table = fieldset.appendChild(document.createElement("table"));
+ table.setAttribute("style", "border:0px; padding:0px");
+ tr = table.insertRow(table.rows.length);
+ td = tr.insertCell(0);
+ td.innerHTML = "Enabled: ";
+ td.setAttribute("style", "text-align:right");
+ td = tr.insertCell(1);
+ td.setAttribute("style", "text-align:left");
+ input = td.appendChild(document.createElement("input"));
+ input.setAttribute("type", "checkbox");
+ input.setAttribute("id", "ixDQStatsEnabled");
+
+ tr = table.insertRow(table.rows.length);
+ td = tr.insertCell(0);
+ td.setAttribute("style", "text-align:right");
+ td.innerHTML = "Difference tolerance (%): ";
+ td = tr.insertCell(1);
+ td.setAttribute("style", "text-align:left");
+ input = td.appendChild(document.createElement("input"));
+ input.setAttribute("type", "text");
+ input.setAttribute("id", "ixDQStatsDiffTol");
+ input.setAttribute("Value", "10");
+
+ tr = table.insertRow(table.rows.length);
+ td = tr.insertCell(0);
+ td.setAttribute("style", "text-align:right");
+ td.innerHTML = "Stability tolerance: ";
+ td = tr.insertCell(1);
+ td.setAttribute("style", "text-align:left");
+ select = td.appendChild(document.createElement("select"));
+ select.setAttribute("id", "ixDQStatsStabTol");
+ select.options[0] = new Option("2", "2");
+ select.options[1] = new Option("3", "3");
+ select.options[2] = new Option("4", "4");
+ select.options[3] = new Option("5", "5");
+ select.options[4] = new Option("6", "6");
+ select.options[2].selected = true;
// Create 'Configuration' section ...
section.appendChild(document.createElement("br"));
@@ -623,6 +653,7 @@ function IndexSection()
tr = table.insertRow(table.rows.length);
td = tr.insertCell(0);
td.innerHTML = "Base timestamp (secs since 1970): ";
+ td.setAttribute("style", "text-align:right");
td = tr.insertCell(1);
input = td.appendChild(document.createElement("input"));
input.setAttribute("type", "text");
@@ -633,6 +664,7 @@ function IndexSection()
tr = table.insertRow(table.rows.length);
td = tr.insertCell(0);
td.innerHTML = "Median window size: ";
+ td.setAttribute("style", "text-align:right");
td = tr.insertCell(1);
input = td.appendChild(document.createElement("input"));
input.setAttribute("type", "text");
diff --git a/src/bmweb/style.css b/src/bmweb/style.css
index cda1891..83e010b 100644
--- a/src/bmweb/style.css
+++ b/src/bmweb/style.css
@@ -101,21 +101,6 @@ a.ixLink_index:hover, a.ixLink_index:active {
background-color:#696969;
}
-a.ixLink_stats:link, a.ixLink_stats:visited {
- display:block;
- font-weight:bold;
- font-size:12px;
- color:#ffffff;
- background-color:#c97f47;
- width:120px;
- text-align:center;
- padding:4px;
- text-decoration:none;
-}
-a.ixLink_stats:hover, a.ixLink_stats:active {
- background-color:#a26739;
-}
-
a.bcLink:link, a.bcLink:visited {
display:block;
font-weight:bold;