From 09e4f98e31a9bb77bebeccd59c70f0715ab2c292 Mon Sep 17 00:00:00 2001 From: Moritz Pflanzer Date: Wed, 30 Aug 2017 12:47:06 +0100 Subject: COMPMID-482: Refactor PMU counters Change-Id: I9b254ce693363ecbbd7c188d211c85471134a91e Reviewed-on: http://mpd-gerrit.cambridge.arm.com/84328 Reviewed-by: Anthony Barbier Tested-by: Kaizen --- tests/framework/instruments/PMUCounter.h | 33 ++++++++------------------------ 1 file changed, 8 insertions(+), 25 deletions(-) (limited to 'tests/framework/instruments/PMUCounter.h') diff --git a/tests/framework/instruments/PMUCounter.h b/tests/framework/instruments/PMUCounter.h index f407be602f..7beb6d931d 100644 --- a/tests/framework/instruments/PMUCounter.h +++ b/tests/framework/instruments/PMUCounter.h @@ -25,6 +25,7 @@ #define ARM_COMPUTE_TEST_PMU_COUNTER #include "Instrument.h" +#include "PMU.h" namespace arm_compute { @@ -33,36 +34,18 @@ namespace test namespace framework { /** Implementation of an instrument to count CPU cycles. */ -class CycleCounter : public Instrument +class PMUCounter : public Instrument { public: - /** Initialise the cycle counter. */ - CycleCounter(); - - std::string id() const override; - void start() override; - void stop() override; - Measurement measurement() const override; + std::string id() const override; + void start() override; + void stop() override; + MeasurementsMap measurements() const override; private: - long _fd{ -1 }; + PMU _pmu_cycles{ PERF_COUNT_HW_CPU_CYCLES }; + PMU _pmu_instructions{ PERF_COUNT_HW_INSTRUCTIONS }; long long _cycles{ 0 }; -}; - -/** Implementation of an instrument to count executed CPU instructions. */ -class InstructionCounter : public Instrument -{ -public: - /** Initialise the instruction counter. */ - InstructionCounter(); - - std::string id() const override; - void start() override; - void stop() override; - Measurement measurement() const override; - -private: - long _fd{ -1 }; long long _instructions{ 0 }; }; } // namespace framework -- cgit v1.2.1