diff options
| author | jasplin <qt-info@nokia.com> | 2010-04-26 07:43:38 +0200 |
|---|---|---|
| committer | jasplin <qt-info@nokia.com> | 2010-04-26 07:43:38 +0200 |
| commit | 5526b7e6d476962fe7a14dd6af774a93d2c50be9 (patch) | |
| tree | 6974a4e463da4b4a4f96bf27014d9a83c2253c1a /src/bm/bmmisc.h | |
| parent | 5a1e7fa55051285110a8a106c90483e110f415ee (diff) | |
Upgraded the index feature.
1: The index itself is computed so that the _change_ in index value
between any two points in time indicates the average performance
increase during this time period in terms of a log2-based
difference. An index value _change_ of 1, 0, and -1 thus
indicates a doubled, unchanged, and halved performance respectively.
(The corresponding linear factors would be 2, 1, and 0.5.).
Note: Individual index values bear no useful meaning when regarded in
isolation. The graph is however shifted vertically so that each
individual index value indicates the change from the index value at the
given base time (the index value of the latter is then 0 and 1 in the
log2 and linear domain respectively).
2: Clicking on a particular data point in the index graph now opens a
page that shows the top-10 results histories that contributed most
significantly to this particular change in the index value.
Each contributor graph indicates the data points that were used for
computing the contribution for this index value.
Diffstat (limited to 'src/bm/bmmisc.h')
| -rw-r--r-- | src/bm/bmmisc.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/bm/bmmisc.h b/src/bm/bmmisc.h index a3d711a..057adac 100644 --- a/src/bm/bmmisc.h +++ b/src/bm/bmmisc.h @@ -27,6 +27,7 @@ #include <QVector> #include <QString> #include <QStringList> +#include <QPair> #include <QImage> #include <QDateTime> #include <QSqlQuery> @@ -52,9 +53,12 @@ public: static bool getMultiOption( const QStringList &args, const QString &option, QStringList *values, QString *error, bool unique = true); + static bool getMultiOption2( + const QStringList &args, const QString &option, QList<QStringList> *values, int n, + QString *error); static bool hasOption(const QStringList &args, const QString &option); static qreal median(const QList<qreal> &values); - + static int medianPos(const QList<qreal> &values, bool lastDuplicate = true); static qreal v2y( const qreal v, const qreal ymax, const qreal vmin, const qreal yfact, const qreal ydefault); static QDateTime createCurrDateTime(int timestamp); @@ -69,6 +73,33 @@ public: static qreal log2diff(qreal val1, qreal val2, const QString &metric); static bool normalize(QList<qreal> &v); static QString compactDateString(int timestamp); + + // ### 2 B DOCUMENTED! + // (Note that a function template cannot be compiled and linked independently, so its + // definition needs to go here) + template <typename T> static void insertRankedId( + QList<QPair<T, qreal> > *ranked, int limit, T t, qreal value) + { + Q_ASSERT(limit >= 0); + + int i; + for (i = 0; (i < limit) && (i < ranked->size()); ++i) { + if (value > ranked->at(i).second) + break; + } + + if (i == limit) + return; + + Q_ASSERT(i <= ranked->size()); + ranked->insert(i, qMakePair(t, value)); + + if (ranked->size() > limit) { + Q_ASSERT(ranked->size() == (limit + 1)); + ranked->removeLast(); + Q_ASSERT(ranked->size() == limit); + } + } }; #endif // BMMISC_H |
