aboutsummaryrefslogtreecommitdiff
path: root/tests/framework/Framework.cpp
diff options
context:
space:
mode:
authorGiorgio Arena <giorgio.arena@arm.com>2017-10-31 17:59:17 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commitce58a9f8f8504c165ca4527bfd991a4029437cba (patch)
treec4360d11603912aa2e1915e5c25e42062218aaa5 /tests/framework/Framework.cpp
parent82afedf2598c8fc5a428ecbd729dd8204b46fd43 (diff)
downloadComputeLibrary-ce58a9f8f8504c165ca4527bfd991a4029437cba.tar.gz
COMPMID-622 Let the user choose the units for the instruments
Change-Id: Ic6ac4cd6df6970593a5e2e6310b6d61951c88898 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/93887 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests/framework/Framework.cpp')
-rw-r--r--tests/framework/Framework.cpp36
1 files changed, 23 insertions, 13 deletions
diff --git a/tests/framework/Framework.cpp b/tests/framework/Framework.cpp
index 38c65fed85..abd32e64e8 100644
--- a/tests/framework/Framework.cpp
+++ b/tests/framework/Framework.cpp
@@ -48,21 +48,30 @@ namespace framework
{
Framework::Framework()
{
- _available_instruments.emplace(InstrumentType::WALL_CLOCK_TIMER, Instrument::make_instrument<WallClockTimer>);
+ _available_instruments.emplace(std::pair<InstrumentType, ScaleFactor>(InstrumentType::WALL_CLOCK_TIMER, ScaleFactor::NONE), Instrument::make_instrument<WallClockTimer, ScaleFactor::NONE>);
+ _available_instruments.emplace(std::pair<InstrumentType, ScaleFactor>(InstrumentType::WALL_CLOCK_TIMER, ScaleFactor::TIME_MS), Instrument::make_instrument<WallClockTimer, ScaleFactor::TIME_MS>);
+ _available_instruments.emplace(std::pair<InstrumentType, ScaleFactor>(InstrumentType::WALL_CLOCK_TIMER, ScaleFactor::TIME_S), Instrument::make_instrument<WallClockTimer, ScaleFactor::TIME_S>);
#ifdef PMU_ENABLED
- _available_instruments.emplace(InstrumentType::PMU, Instrument::make_instrument<PMUCounter>);
+ _available_instruments.emplace(std::pair<InstrumentType, ScaleFactor>(InstrumentType::PMU, ScaleFactor::NONE), Instrument::make_instrument<PMUCounter, ScaleFactor::NONE>);
+ _available_instruments.emplace(std::pair<InstrumentType, ScaleFactor>(InstrumentType::PMU, ScaleFactor::SCALE_1K), Instrument::make_instrument<PMUCounter, ScaleFactor::SCALE_1K>);
+ _available_instruments.emplace(std::pair<InstrumentType, ScaleFactor>(InstrumentType::PMU, ScaleFactor::SCALE_1M), Instrument::make_instrument<PMUCounter, ScaleFactor::SCALE_1M>);
#endif /* PMU_ENABLED */
#ifdef MALI_ENABLED
- _available_instruments.emplace(InstrumentType::MALI, Instrument::make_instrument<MaliCounter>);
+ _available_instruments.emplace(std::pair<InstrumentType, ScaleFactor>(InstrumentType::MALI, ScaleFactor::NONE), Instrument::make_instrument<MaliCounter, ScaleFactor::NONE>);
+ _available_instruments.emplace(std::pair<InstrumentType, ScaleFactor>(InstrumentType::MALI, ScaleFactor::SCALE_1K), Instrument::make_instrument<MaliCounter, ScaleFactor::SCALE_1K>);
+ _available_instruments.emplace(std::pair<InstrumentType, ScaleFactor>(InstrumentType::MALI, ScaleFactor::SCALE_1M), Instrument::make_instrument<MaliCounter, ScaleFactor::SCALE_1M>);
#endif /* MALI_ENABLED */
#ifdef OPENCL_TIMER_ENABLED
- _available_instruments.emplace(InstrumentType::OPENCL_TIMER, Instrument::make_instrument<OpenCLTimer>);
+ _available_instruments.emplace(std::pair<InstrumentType, ScaleFactor>(InstrumentType::OPENCL_TIMER, ScaleFactor::NONE), Instrument::make_instrument<OpenCLTimer, ScaleFactor::NONE>);
+ _available_instruments.emplace(std::pair<InstrumentType, ScaleFactor>(InstrumentType::OPENCL_TIMER, ScaleFactor::TIME_US), Instrument::make_instrument<OpenCLTimer, ScaleFactor::TIME_US>);
+ _available_instruments.emplace(std::pair<InstrumentType, ScaleFactor>(InstrumentType::OPENCL_TIMER, ScaleFactor::TIME_MS), Instrument::make_instrument<OpenCLTimer, ScaleFactor::TIME_MS>);
+ _available_instruments.emplace(std::pair<InstrumentType, ScaleFactor>(InstrumentType::OPENCL_TIMER, ScaleFactor::TIME_S), Instrument::make_instrument<OpenCLTimer, ScaleFactor::TIME_S>);
#endif /* OPENCL_TIMER_ENABLED */
}
-std::set<InstrumentType> Framework::available_instruments() const
+std::set<InstrumentsDescription> Framework::available_instruments() const
{
- std::set<InstrumentType> types;
+ std::set<InstrumentsDescription> types;
for(const auto &instrument : _available_instruments)
{
@@ -90,13 +99,14 @@ Framework &Framework::get()
return instance;
}
-void Framework::init(const std::vector<InstrumentType> &instruments, int num_iterations, DatasetMode mode, const std::string &name_filter, const std::string &id_filter, LogLevel log_level)
+void Framework::init(const std::vector<framework::InstrumentsDescription> &instruments, int num_iterations, DatasetMode mode, const std::string &name_filter, const std::string &id_filter,
+ LogLevel log_level)
{
_test_filter = TestFilter(mode, name_filter, id_filter);
_num_iterations = num_iterations;
_log_level = log_level;
- _instruments = std::set<InstrumentType>(instruments.begin(), instruments.end());
+ _instruments = std::set<framework::InstrumentsDescription>(instruments.begin(), instruments.end());
}
std::string Framework::current_suite_name() const
@@ -579,13 +589,13 @@ Profiler Framework::get_profiler() const
const bool all_instruments = std::any_of(
_instruments.begin(),
_instruments.end(),
- [](InstrumentType type) -> bool { return type == InstrumentType::ALL; });
+ [](InstrumentsDescription type) -> bool { return type.first == InstrumentType::ALL; });
- auto is_selected = [&](InstrumentType instrument) -> bool
+ auto is_selected = [&](InstrumentsDescription 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;
+ return std::find_if(_instruments.begin(), _instruments.end(), [&](InstrumentsDescription type) -> bool {
+ const auto group = static_cast<InstrumentType>(static_cast<uint64_t>(type.first) & 0xFF00);
+ return (group == instrument.first) && (instrument.second == type.second);
})
!= _instruments.end();
};