From 0cb9c0f14582a6e91d44765748154906e75e9baa Mon Sep 17 00:00:00 2001 From: jasplin Date: Tue, 4 May 2010 08:31:29 +0200 Subject: Prepare data quality stats feature. --- src/bm/bmrequest.cpp | 21 +++++++++++-- src/bm/bmrequest.h | 8 ++++- src/bm/index.cpp | 31 +++++++++++++++++++ src/bmclient/main.cpp | 45 ++++++++++++++++++++++++++-- src/bmweb/indexsection.js | 76 +++++++++++++++++++++++++++++++++-------------- src/bmweb/style.css | 15 ---------- 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( "") - .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("").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 indexValues; QList contrCounts; - QList > topContr; + QList > 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) = + // SFP(90) = + // SFP(80) = + // ... + // SFP(10) = + // + // (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