From a4f711b0fa38aecf0aacdbf61acf86bd25aa674a Mon Sep 17 00:00:00 2001 From: Moritz Pflanzer Date: Wed, 5 Jul 2017 11:02:23 +0100 Subject: COMPMID-415: New framework - instruments [3/5] Change-Id: I834c2693566185ce8d8d024fb5db79610a18c8c1 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/79757 Reviewed-by: Anthony Barbier Tested-by: Kaizen --- framework/Framework.h | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'framework/Framework.h') diff --git a/framework/Framework.h b/framework/Framework.h index e9beafd6eb..fbc95badd6 100644 --- a/framework/Framework.h +++ b/framework/Framework.h @@ -24,10 +24,12 @@ #ifndef ARM_COMPUTE_TEST_FRAMEWORK #define ARM_COMPUTE_TEST_FRAMEWORK +#include "Profiler.h" #include "TestCase.h" #include "TestCaseFactory.h" #include "TestResult.h" #include "Utils.h" +#include "instruments/Instruments.h" #include #include @@ -70,13 +72,20 @@ public: */ static Framework &get(); + /** Supported instrument types for benchmarking. + * + * @return Set of all available instrument types. + */ + std::set available_instruments() const; + /** Init the framework. * + * @param[in] instruments Instrument types that will be used for benchmarking. * @param[in] num_iterations Number of iterations per test. * @param[in] name_filter Regular expression to filter tests by name. Only matching tests will be executed. * @param[in] id_filter Regular expression to filter tests by id. Only matching tests will be executed. */ - void init(int num_iterations, const std::string &name_filter, const std::string &id_filter); + void init(const std::vector &instruments, int num_iterations, const std::string &name_filter, const std::string &id_filter); /** Add a new test suite. * @@ -181,6 +190,15 @@ public: */ void set_test_result(std::string test_case_name, TestResult result); + /** Factory method to obtain a configured profiler. + * + * The profiler enables all instruments that have been passed to the @ref + * init method. + * + * @return Configured profiler to collect benchmark results. + */ + Profiler get_profiler() const; + /** List of @ref TestId's. * * @return Vector with all test ids. @@ -188,7 +206,7 @@ public: std::vector test_ids() const; private: - Framework() = default; + Framework(); ~Framework() = default; Framework(const Framework &) = delete; @@ -214,8 +232,12 @@ private: int _num_iterations{ 1 }; bool _throw_errors{ false }; - std::regex _test_name_filter{ ".*" }; - std::regex _test_id_filter{ ".*" }; + using create_function = std::unique_ptr(); + std::map _available_instruments{}; + + InstrumentType _instruments{ InstrumentType::NONE }; + std::regex _test_name_filter{ ".*" }; + std::regex _test_id_filter{ ".*" }; }; template -- cgit v1.2.1