diff options
author | Moritz Pflanzer <moritz.pflanzer@arm.com> | 2017-08-30 12:47:06 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | 09e4f98e31a9bb77bebeccd59c70f0715ab2c292 (patch) | |
tree | dcf5992df5961042a221cb426372eeb21a2d8023 /tests/framework/Framework.cpp | |
parent | 906443f38fe2c168f4a0b2db5cd9852865fc4922 (diff) | |
download | ComputeLibrary-09e4f98e31a9bb77bebeccd59c70f0715ab2c292.tar.gz |
COMPMID-482: Refactor PMU counters
Change-Id: I9b254ce693363ecbbd7c188d211c85471134a91e
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/84328
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'tests/framework/Framework.cpp')
-rw-r--r-- | tests/framework/Framework.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/tests/framework/Framework.cpp b/tests/framework/Framework.cpp index 8d015c69d2..7b761d5936 100644 --- a/tests/framework/Framework.cpp +++ b/tests/framework/Framework.cpp @@ -45,8 +45,7 @@ Framework::Framework() { _available_instruments.emplace(InstrumentType::WALL_CLOCK_TIMER, Instrument::make_instrument<WallClockTimer>); #ifdef PMU_ENABLED - _available_instruments.emplace(InstrumentType::PMU_CYCLE_COUNTER, Instrument::make_instrument<CycleCounter>); - _available_instruments.emplace(InstrumentType::PMU_INSTRUCTION_COUNTER, Instrument::make_instrument<InstructionCounter>); + _available_instruments.emplace(InstrumentType::PMU, Instrument::make_instrument<PMUCounter>); #endif /* PMU_ENABLED */ } @@ -86,12 +85,7 @@ void Framework::init(const std::vector<InstrumentType> &instruments, int num_ite _num_iterations = num_iterations; _log_level = log_level; - _instruments = InstrumentType::NONE; - - for(const auto &instrument : instruments) - { - _instruments |= instrument; - } + _instruments = std::set<InstrumentType>(instruments.begin(), instruments.end()); } std::string Framework::current_suite_name() const @@ -461,9 +455,23 @@ Profiler Framework::get_profiler() const { Profiler profiler; + const bool all_instruments = std::any_of( + _instruments.begin(), + _instruments.end(), + [](InstrumentType type) -> bool { return type == InstrumentType::ALL; }); + + auto is_selected = [&](InstrumentType instrument) -> bool + { + return std::find_if(_instruments.begin(), _instruments.end(), [&](InstrumentType type) -> bool { + const auto group = static_cast<InstrumentType>(static_cast<uint64_t>(type) & 0xFF00); + return group == instrument; + }) + != _instruments.end(); + }; + for(const auto &instrument : _available_instruments) { - if((instrument.first & _instruments) != InstrumentType::NONE) + if(all_instruments || is_selected(instrument.first)) { profiler.add(instrument.second()); } |