| 1 | // Copyright (C) 2016 Intel Corporation. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QBENCHMARKPERFEVENTS_P_H |
| 5 | #define QBENCHMARKPERFEVENTS_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtTest/private/qbenchmarkmeasurement_p.h> |
| 19 | |
| 20 | QT_BEGIN_NAMESPACE |
| 21 | |
| 22 | class QBenchmarkPerfEventsMeasurer : public QBenchmarkMeasurerBase |
| 23 | { |
| 24 | public: |
| 25 | QBenchmarkPerfEventsMeasurer(); |
| 26 | ~QBenchmarkPerfEventsMeasurer(); |
| 27 | void start() override; |
| 28 | QList<Measurement> stop() override; |
| 29 | bool isMeasurementAccepted(Measurement measurement) override; |
| 30 | int adjustIterationCount(int suggestion) override; |
| 31 | int adjustMedianCount(int suggestion) override; |
| 32 | bool needsWarmupIteration() override { return true; } |
| 33 | |
| 34 | static bool isAvailable(); |
| 35 | static void setCounter(const char *name); |
| 36 | static void listCounters(); |
| 37 | private: |
| 38 | QList<int> fds; |
| 39 | |
| 40 | Measurement readValue(qsizetype idx = 0); |
| 41 | }; |
| 42 | |
| 43 | QT_END_NAMESPACE |
| 44 | |
| 45 | #endif // QBENCHMARKPERFEVENTS_P_H |
| 46 | |