diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-10-21 11:04:26 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-11-09 02:18:44 -0700 |
commit | 985b94215276eebf4acdd2625829d90a27213d64 (patch) | |
tree | 9ba8425bb4aa20f5be8478accd694099416331d7 /src/testlib/qbenchmarkperfevents.cpp | |
parent | 0f55580ec5e48d1e56e31de3b264d0f4a336245c (diff) | |
download | qtbase-985b94215276eebf4acdd2625829d90a27213d64.tar.gz |
QBenchlib: pass the metric type alongside the measurement value
And pass the value in a qreal, which is what QBenchlib stores
anyway. This increases the code size a little because the conversion
from integer to qreal is in multiple places, but doesn't meaningfully
increase the overhead: in the SysV ABI, we still return Measurement in
registers and even using the floating point registers where applicable.
This is the first step in allowing the Perf benchmarker to benchmark more
than one event.
Change-Id: I3c79b7e08fa346988dfefffd172027a8677f17c0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/testlib/qbenchmarkperfevents.cpp')
-rw-r--r-- | src/testlib/qbenchmarkperfevents.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/testlib/qbenchmarkperfevents.cpp b/src/testlib/qbenchmarkperfevents.cpp index 72318006c2..a6295d6e11 100644 --- a/src/testlib/qbenchmarkperfevents.cpp +++ b/src/testlib/qbenchmarkperfevents.cpp @@ -474,14 +474,14 @@ void QBenchmarkPerfEventsMeasurer::start() ::ioctl(fd, PERF_EVENT_IOC_ENABLE); } -qint64 QBenchmarkPerfEventsMeasurer::stop() +QBenchmarkMeasurerBase::Measurement QBenchmarkPerfEventsMeasurer::stop() { // disable the counter ::ioctl(fd, PERF_EVENT_IOC_DISABLE); return readValue(); } -bool QBenchmarkPerfEventsMeasurer::isMeasurementAccepted(qint64) +bool QBenchmarkPerfEventsMeasurer::isMeasurementAccepted(Measurement) { return true; } @@ -496,11 +496,6 @@ int QBenchmarkPerfEventsMeasurer::adjustMedianCount(int) return 1; } -QTest::QBenchmarkMetric QBenchmarkPerfEventsMeasurer::metricType() -{ - return metricForEvent(attr.type, attr.config); -} - static quint64 rawReadValue(int fd) { /* from the kernel docs: @@ -536,10 +531,10 @@ static quint64 rawReadValue(int fd) return results.value * (double(results.time_running) / double(results.time_enabled)); } -qint64 QBenchmarkPerfEventsMeasurer::readValue() +QBenchmarkMeasurerBase::Measurement QBenchmarkPerfEventsMeasurer::readValue() { quint64 raw = rawReadValue(fd); - return raw; + return { qreal(qint64(raw)), metricForEvent(attr.type, attr.config) }; } QT_END_NAMESPACE |