diff options
Diffstat (limited to 'tests/framework')
64 files changed, 587 insertions, 181 deletions
diff --git a/tests/framework/Asserts.h b/tests/framework/Asserts.h index 9d6d4fad9a..7adfa8f2f3 100644 --- a/tests/framework/Asserts.h +++ b/tests/framework/Asserts.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2022 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -30,6 +30,8 @@ #include <sstream> #include <type_traits> +#include "utils/TypePrinter.h" + namespace arm_compute { namespace test @@ -42,6 +44,11 @@ inline int make_printable(int8_t value) return value; } +inline std::string make_printable(const arm_compute::WeightFormat wf) +{ + return arm_compute::to_string(wf); +} + inline unsigned int make_printable(uint8_t value) { return value; @@ -135,6 +142,59 @@ ARM_COMPUTE_TEST_COMP_FACTORY(ASSERT, Assertion, !=, NOT_EQUAL, throw arm_comput arm_compute::test::framework::Framework::get().clear_test_info(); \ } while(false) +#define ARM_COMPUTE_EXPECT_NO_THROW(X, LEVEL) \ + do \ + { \ + try \ + { \ + const auto &x = X; \ + (void)x; \ + } \ + catch(...) \ + { \ + std::stringstream msg; \ + msg << "Expectation '" #X "' to not throw failed.\n"; \ + arm_compute::test::framework::Framework::get().print_test_info(msg); \ + arm_compute::test::framework::Framework::get().log_failed_expectation(arm_compute::test::framework::TestError(msg.str(), LEVEL)); \ + } \ + arm_compute::test::framework::Framework::get().clear_test_info(); \ + } while(false) + +#if defined(ARM_COMPUTE_ASSERTS_ENABLED) +#define ARM_COMPUTE_EXPECT_THROW(X, LEVEL) \ + do \ + { \ + bool exception_caught = false; \ + try \ + { \ + const auto &x = X; \ + (void)x; \ + } \ + catch(...) \ + { \ + exception_caught = true; \ + } \ + if(!exception_caught) \ + { \ + std::stringstream msg; \ + msg << "Expectation '" #X "' to throw failed.\n"; \ + arm_compute::test::framework::Framework::get().print_test_info(msg); \ + arm_compute::test::framework::Framework::get().log_failed_expectation(arm_compute::test::framework::TestError(msg.str(), LEVEL)); \ + } \ + arm_compute::test::framework::Framework::get().clear_test_info(); \ + } while(false) +#else // defined(ARM_COMPUTE_ASSERTS_ENABLED) +#define ARM_COMPUTE_EXPECT_THROW(X, LEVEL) \ + do \ + { \ + std::stringstream msg; \ + msg << "'" #X "' Skipped: asserts disabled, cannot throw\n"; \ + arm_compute::test::framework::Framework::get().print_test_info(msg); \ + arm_compute::test::framework::Framework::get().log_info(msg.str()); \ + arm_compute::test::framework::Framework::get().clear_test_info(); \ + } while(false) +#endif // defined(ARM_COMPUTE_ASSERTS_ENABLED) + #define ARM_COMPUTE_ASSERT_FAIL(MSG) \ do \ { \ diff --git a/tests/framework/BUILD.bazel b/tests/framework/BUILD.bazel new file mode 100644 index 0000000000..17d5a15a11 --- /dev/null +++ b/tests/framework/BUILD.bazel @@ -0,0 +1,63 @@ +# Copyright (c) 2023 Arm Limited. +# +# SPDX-License-Identifier: MIT +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +cc_library( + name = "framework", + srcs = glob( + [ + "*.cpp", + "command_line/*.cpp", + "printers/*.cpp", + "datasets/*.cpp", + "instruments/*.cpp", + "instruments/*.hpp", + ], + exclude = [ + "**/*PMU*", + "**/*OpenCL*", + "**/*MaliCounter*", + ], + ), + hdrs = glob([ + "*.h", + "command_line/*.h", + "printers/*.h", + "datasets/*.h", + "instruments/*.h", + ]), + copts = [ + "-Wno-overloaded-virtual", + ] + select({ + "//:arch_armv8-a": ["-march=armv8-a"], + "//:arch_armv8.2-a+fp16": ["-march=armv8.2-a+fp16"], + "//conditions:default": ["-march=armv8-a"], + }), + linkstatic = True, + visibility = ["//visibility:public"], + deps = [ + "//arm_compute:core_headers", + "//arm_compute:graph_headers", + "//arm_compute:runtime_headers", + "//support", + "//utils", + ], +) diff --git a/tests/framework/DatasetModes.cpp b/tests/framework/DatasetModes.cpp index 0224bd8ede..5acc792628 100644 --- a/tests/framework/DatasetModes.cpp +++ b/tests/framework/DatasetModes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2019 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/DatasetModes.h b/tests/framework/DatasetModes.h index c970550d01..19a3cb483c 100644 --- a/tests/framework/DatasetModes.h +++ b/tests/framework/DatasetModes.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2019 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/Exceptions.cpp b/tests/framework/Exceptions.cpp index 0ca86a8589..54936124a3 100644 --- a/tests/framework/Exceptions.cpp +++ b/tests/framework/Exceptions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/Exceptions.h b/tests/framework/Exceptions.h index 687305b452..75de683857 100644 --- a/tests/framework/Exceptions.h +++ b/tests/framework/Exceptions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/Fixture.h b/tests/framework/Fixture.h index 916dcc7fef..7692bca21e 100644 --- a/tests/framework/Fixture.h +++ b/tests/framework/Fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/Framework.cpp b/tests/framework/Framework.cpp index dff280dc8c..bfb955c525 100644 --- a/tests/framework/Framework.cpp +++ b/tests/framework/Framework.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 ARM Limited. + * Copyright (c) 2017-2021, 2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -24,7 +24,6 @@ #include "Framework.h" #include "arm_compute/runtime/Scheduler.h" -#include "support/MemorySupport.h" #include "tests/framework/ParametersLibrary.h" #include "tests/framework/TestFilter.h" @@ -36,6 +35,7 @@ #include <chrono> #include <iostream> +#include <memory> #include <sstream> #include <type_traits> @@ -94,7 +94,7 @@ Framework::Framework() Instrument::make_instrument<OpenCLMemoryUsage, ScaleFactor::SCALE_1M>); #endif /* ARM_COMPUTE_CL */ - instruments_info = support::cpp14::make_unique<InstrumentsInfo>(); + instruments_info = std::make_unique<InstrumentsInfo>(); } std::set<InstrumentsDescription> Framework::available_instruments() const @@ -130,9 +130,12 @@ Framework &Framework::get() void Framework::init(const FrameworkConfig &config) { _test_filter.reset(new TestFilter(config.mode, config.name_filter, config.id_filter)); - _num_iterations = config.num_iterations; - _log_level = config.log_level; - _cooldown_sec = config.cooldown_sec; + _num_iterations = config.num_iterations; + _log_level = config.log_level; + _cooldown_sec = config.cooldown_sec; + _configure_only = config.configure_only; + _print_rerun_cmd = config.print_rerun_cmd; + _seed = config.seed; _instruments = std::set<framework::InstrumentsDescription>(std::begin(config.instruments), std::end(config.instruments)); } @@ -208,6 +211,7 @@ void Framework::log_test_end(const TestInfo &info) { func_on_all_printers([&](Printer * p) { + p->print_profiler_header(_test_results.at(info).header_data); p->print_measurements(_test_results.at(info).measurements); }); } @@ -290,13 +294,13 @@ bool Framework::error_on_missing_assets() const return _error_on_missing_assets; } -void Framework::run_test(const TestInfo &info, TestCaseFactory &test_factory) +TestResult::Status Framework::run_test(const TestInfo &info, TestCaseFactory &test_factory) { if(test_factory.status() == TestCaseFactory::Status::DISABLED) { log_test_skipped(info); set_test_result(info, TestResult(TestResult::Status::DISABLED)); - return; + return TestResult::Status::DISABLED; } log_test_start(info); @@ -527,14 +531,16 @@ void Framework::run_test(const TestInfo &info, TestCaseFactory &test_factory) { if(_stop_on_error) { - throw std::runtime_error("Abort on first error."); + throw std::runtime_error("Abandon on first error."); } } + result.header_data = profiler.header(); result.measurements = profiler.measurements(); set_test_result(info, result); log_test_end(info); + return result.status; } bool Framework::run() @@ -554,6 +560,7 @@ bool Framework::run() int id = 0; int id_run_test = 0; + ARM_COMPUTE_UNUSED(id_run_test); // Not used if ARM_COMPUTE_CL is not defined for(auto &test_factory : _test_factories) { @@ -577,9 +584,11 @@ bool Framework::run() CLScheduler::get().set_queue(new_queue); } #endif // ARM_COMPUTE_CL - - run_test(test_info, *test_factory); - + TestResult::Status result = run_test(test_info, *test_factory); + if((_print_rerun_cmd) && (result == TestResult::Status::CRASHED || result == TestResult::Status::FAILED)) + { + std::cout << "Rerun command: ./arm_compute_validation --filter='^" << test_info.name << "$' --seed=" << _seed << std::endl; + } ++id_run_test; // Run test delay @@ -629,6 +638,7 @@ void Framework::print_test_results(Printer &printer) const for(const auto &test : _test_results) { printer.print_test_header(test.first); + printer.print_profiler_header(test.second.header_data); printer.print_measurements(test.second.measurements); printer.print_test_footer(); } @@ -678,7 +688,7 @@ std::vector<TestInfo> Framework::test_infos() const for(const auto &factory : _test_factories) { - TestInfo test_info{ id, factory->name(), factory->mode(), factory->status() }; + const TestInfo test_info{ id, factory->name(), factory->mode(), factory->status() }; if(_test_filter->is_selected(test_info)) { @@ -701,6 +711,21 @@ void Framework::set_instruments_info(InstrumentsInfo instr_info) ARM_COMPUTE_ERROR_ON(instruments_info == nullptr); *instruments_info = instr_info; } + +bool Framework::configure_only() const +{ + return _configure_only; +} + +bool Framework::new_fixture_call() const +{ + return _new_fixture_call; +} + +void Framework::set_new_fixture_call(bool val) +{ + _new_fixture_call = val; +} } // namespace framework } // namespace test } // namespace arm_compute diff --git a/tests/framework/Framework.h b/tests/framework/Framework.h index 11dedfe89f..2dded30038 100644 --- a/tests/framework/Framework.h +++ b/tests/framework/Framework.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 ARM Limited. + * Copyright (c) 2017-2021, 2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -63,6 +63,9 @@ struct FrameworkConfig int num_iterations{ 1 }; /**< Number of iterations per test. */ float cooldown_sec{ -1.f }; /**< Delay between tests in seconds. */ LogLevel log_level{ LogLevel::NONE }; /**< Verbosity of the output. */ + bool configure_only{ false }; /**< Only configure kernels */ + bool print_rerun_cmd{ false }; /**< Print the command to rerun the failed testcase */ + unsigned int seed{ 0 }; /**< The seed that is used to fill tensors with random values.*/ }; /** Information about a test case. @@ -120,8 +123,6 @@ public: * registering test cases. * * @param[in] name Name of the added test suite. - * - * @return Name of the current test suite. */ void push_suite(std::string name); @@ -229,13 +230,13 @@ public: /** Indicates if test execution is stopped after the first failed test. * - * @return True if the execution is going to be aborted after the first failed test. + * @return True if the execution is going to be stopped after the first failed test. */ bool stop_on_error() const; - /** Set whether to abort execution after the first failed test. + /** Set whether to stop execution after the first failed test. * - * @param[in] stop_on_error True if execution is going to be aborted after first failed test. + * @param[in] stop_on_error True if execution is going to be stopped after first failed test. */ void set_stop_on_error(bool stop_on_error); @@ -306,6 +307,21 @@ public: * @param[in] instr_info Instruments info to set */ void set_instruments_info(InstrumentsInfo instr_info); + /** Get the configure only flag + * + * @return The current configure only flag. + */ + bool configure_only() const; + /** Return whether the new fixture has been called + * + * @return The current new fixture call flag. + */ + bool new_fixture_call() const; + /** Set the new fixture call flag + * + * @param[in] val Value to set for the flag + */ + void set_new_fixture_call(bool val); private: Framework(); @@ -314,7 +330,7 @@ private: Framework(const Framework &) = delete; Framework &operator=(const Framework &) = delete; - void run_test(const TestInfo &info, TestCaseFactory &test_factory); + TestResult::Status run_test(const TestInfo &info, TestCaseFactory &test_factory); std::map<TestResult::Status, int> count_test_results() const; /** Returns the current test suite name. @@ -340,6 +356,10 @@ private: bool _stop_on_error{ false }; bool _error_on_missing_assets{ false }; std::vector<Printer *> _printers{}; + bool _configure_only{ false }; + bool _new_fixture_call{ false }; + bool _print_rerun_cmd{ false }; + unsigned int _seed{ 0 }; using create_function = std::unique_ptr<Instrument>(); std::map<InstrumentsDescription, create_function *> _available_instruments{}; @@ -355,7 +375,7 @@ private: template <typename T> inline void Framework::add_test_case(std::string test_name, DatasetMode mode, TestCaseFactory::Status status) { - _test_factories.emplace_back(support::cpp14::make_unique<SimpleTestCaseFactory<T>>(current_suite_name(), std::move(test_name), mode, status)); + _test_factories.emplace_back(std::make_unique<SimpleTestCaseFactory<T>>(current_suite_name(), std::move(test_name), mode, status)); } template <typename T, typename D> diff --git a/tests/framework/Macros.h b/tests/framework/Macros.h index 275ea886d6..5ce0842864 100644 --- a/tests/framework/Macros.h +++ b/tests/framework/Macros.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2021, 2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -49,8 +49,8 @@ #define CONCAT(ARG0, ARG1) ARG0##ARG1 -#define VARIADIC_SIZE_IMPL(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, size, ...) size -#define VARIADIC_SIZE(...) VARIADIC_SIZE_IMPL(__VA_ARGS__, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) +#define VARIADIC_SIZE_IMPL(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, size, ...) size +#define VARIADIC_SIZE(...) VARIADIC_SIZE_IMPL(__VA_ARGS__, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) #define JOIN_PARAM1(OP, param) OP(0, param) #define JOIN_PARAM2(OP, param, ...) \ @@ -92,6 +92,12 @@ #define JOIN_PARAM14(OP, param, ...) \ OP(13, param) \ , JOIN_PARAM13(OP, __VA_ARGS__) +#define JOIN_PARAM15(OP, param, ...) \ + OP(14, param) \ + , JOIN_PARAM14(OP, __VA_ARGS__) +#define JOIN_PARAM16(OP, param, ...) \ + OP(15, param) \ + , JOIN_PARAM15(OP, __VA_ARGS__) #define JOIN_PARAM(OP, NUM, ...) \ CONCAT(JOIN_PARAM, NUM) \ (OP, __VA_ARGS__) @@ -111,15 +117,29 @@ explicit TEST_NAME(D &&data) : DataTestCase{ std::forward<D>(data) } \ { \ } -#define FIXTURE_SETUP(FIXTURE) \ - void do_setup() override \ - { \ - FIXTURE::setup(); \ +#define FIXTURE_SETUP(FIXTURE) \ + void do_setup() override \ + { \ + framework::Framework::get().set_new_fixture_call(false); \ + FIXTURE::setup(); \ } -#define FIXTURE_DATA_SETUP(FIXTURE) \ - void do_setup() override \ - { \ - apply(this, &FIXTURE::setup<As...>, _data); \ +#define FIXTURE_DATA_SETUP(FIXTURE) \ + void do_setup() override \ + { \ + framework::Framework::get().set_new_fixture_call(false); \ + apply(this, &FIXTURE::setup, _data); \ + } +#define FIXTURE_DATA_SETUP_NEW(FIXTURE) \ + void do_setup() override \ + { \ + framework::Framework::get().set_new_fixture_call(true); \ + apply(this, &FIXTURE::setup, _data); \ + configure_target(); \ + if(!framework::Framework::get().configure_only()) \ + { \ + allocate_and_run_target(); \ + compute_reference(); \ + } \ } #define FIXTURE_RUN(FIXTURE) \ void do_run() override \ @@ -210,6 +230,11 @@ #define DISABLED_FIXTURE_TEST_CASE(TEST_NAME, FIXTURE, MODE) \ FIXTURE_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::DISABLED) +#define EMPTY_BODY_FIXTURE_TEST_CASE(TEST_NAME, FIXTURE, MODE) \ + FIXTURE_TEST_CASE(TEST_NAME, FIXTURE, MODE) \ + { \ + } + #define FIXTURE_DATA_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, STATUS, DATASET) \ template <typename T> \ class TEST_NAME; \ @@ -233,6 +258,29 @@ #define DISABLED_FIXTURE_DATA_TEST_CASE(TEST_NAME, FIXTURE, MODE, DATASET) \ FIXTURE_DATA_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::DISABLED, DATASET) +#define FIXTURE_DATA_TEST_CASE_NEW_IMPL(TEST_NAME, FIXTURE, MODE, STATUS, DATASET) \ + template <typename T> \ + class TEST_NAME; \ + template <typename... As> \ + class TEST_NAME<std::tuple<As...>> : public arm_compute::test::framework::DataTestCase<decltype(DATASET)::type>, public FIXTURE \ + { \ + public: \ + DATA_TEST_CASE_CONSTRUCTOR(TEST_NAME, DATASET) \ + FIXTURE_DATA_SETUP_NEW(FIXTURE) \ + void do_run() override; \ + FIXTURE_TEARDOWN(FIXTURE) \ + }; \ + DATA_TEST_REGISTRAR(TEST_NAME, MODE, STATUS, DATASET); \ + template <typename... As> \ + void TEST_NAME<std::tuple<As...>>::do_run() + +#define FIXTURE_DATA_TEST_CASE_NEW(TEST_NAME, FIXTURE, MODE, DATASET) \ + FIXTURE_DATA_TEST_CASE_NEW_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::ACTIVE, DATASET) +#define EXPECTED_FAILURE_FIXTURE_DATA_TEST_CASE_NEW(TEST_NAME, FIXTURE, MODE, DATASET) \ + FIXTURE_DATA_TEST_CASE_NEW_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::EXPECTED_FAILURE, DATASET) +#define DISABLED_FIXTURE_DATA_TEST_CASE_NEW(TEST_NAME, FIXTURE, MODE, DATASET) \ + FIXTURE_DATA_TEST_CASE_NEW_IMPL(TEST_NAME, FIXTURE, MODE, arm_compute::test::framework::TestCaseFactory::Status::DISABLED, DATASET) + #define REGISTER_FIXTURE_TEST_CASE_IMPL(TEST_NAME, FIXTURE, MODE, STATUS) \ class TEST_NAME : public arm_compute::test::framework::TestCase, public FIXTURE \ { \ @@ -276,4 +324,4 @@ // // TEST CASE MACROS END // -#endif /* ARM_COMPUTE_TEST_FRAMEWORK_MACROS */
\ No newline at end of file +#endif /* ARM_COMPUTE_TEST_FRAMEWORK_MACROS */ diff --git a/tests/framework/ParametersLibrary.cpp b/tests/framework/ParametersLibrary.cpp index 4af4179bda..5041653cac 100644 --- a/tests/framework/ParametersLibrary.cpp +++ b/tests/framework/ParametersLibrary.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 ARM Limited. + * Copyright (c) 2019-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -56,12 +56,5 @@ typename ContextType<CLTensor>::type *ParametersLibrary::get_ctx<CLTensor>() } #endif /* ARM_COMPUTE_CL */ -#if ARM_COMPUTE_GC -template <> -typename ContextType<GCTensor>::type *ParametersLibrary::get_ctx<GCTensor>() -{ - return static_cast<typename ContextType<GCTensor>::type *>(_gc_ctx.get()); -} -#endif /* ARM_COMPUTE_GC */ } // namespace test } // namespace arm_compute diff --git a/tests/framework/ParametersLibrary.h b/tests/framework/ParametersLibrary.h index 9b325beccd..d3677726ad 100644 --- a/tests/framework/ParametersLibrary.h +++ b/tests/framework/ParametersLibrary.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 ARM Limited. + * Copyright (c) 2019-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -30,10 +30,6 @@ #include "arm_compute/runtime/CL/CLRuntimeContext.h" #include "arm_compute/runtime/CL/CLTensor.h" #endif /* ARM_COMPUTE_CL */ -#ifdef ARM_COMPUTE_GC -#include "arm_compute/runtime/GLES_COMPUTE/GCRuntimeContext.h" -#include "arm_compute/runtime/GLES_COMPUTE/GCTensor.h" -#endif /* ARM_COMPUTE_GC */ #include <memory> @@ -61,14 +57,6 @@ struct ContextType<CLTensor> }; #endif /* ARM_COMPUTE_CL */ -#ifdef ARM_COMPUTE_GC -template <> -struct ContextType<GCTensor> -{ - using type = GCRuntimeContext; -}; -#endif /* ARM_COMPUTE_GC */ - /** Class that contains all the global parameters used by the tests */ class ParametersLibrary final { diff --git a/tests/framework/Profiler.cpp b/tests/framework/Profiler.cpp index 7b95279b31..a4a9beaa29 100644 --- a/tests/framework/Profiler.cpp +++ b/tests/framework/Profiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018,2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -81,6 +81,8 @@ void Profiler::test_stop() { _measurements[instrument->id() + "/" + measurement.first].push_back(measurement.second); } + + _header_data = instrument->instrument_header(); } } @@ -88,6 +90,11 @@ const Profiler::MeasurementsMap &Profiler::measurements() const { return _measurements; } + +const std::string &Profiler::header() const +{ + return _header_data; +} } // namespace framework } // namespace test } // namespace arm_compute diff --git a/tests/framework/Profiler.h b/tests/framework/Profiler.h index 34c5224528..7df085c8f1 100644 --- a/tests/framework/Profiler.h +++ b/tests/framework/Profiler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018,2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -87,9 +87,16 @@ public: */ const MeasurementsMap &measurements() const; + /** Return JSON formatted header data. + * + * @returns JSON formmated string + */ + const std::string &header() const; + private: std::vector<std::unique_ptr<Instrument>> _instruments{}; MeasurementsMap _measurements{}; + std::string _header_data{}; }; } // namespace framework } // namespace test diff --git a/tests/framework/Registrars.h b/tests/framework/Registrars.h index ca23edf0de..c22177c9e6 100644 --- a/tests/framework/Registrars.h +++ b/tests/framework/Registrars.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/SConscript b/tests/framework/SConscript index b8574bd998..450ffd77b0 100644 --- a/tests/framework/SConscript +++ b/tests/framework/SConscript @@ -1,4 +1,7 @@ -# Copyright (c) 2017 ARM Limited. +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Copyright (c) 2017-2022 Arm Limited. # # SPDX-License-Identifier: MIT # @@ -27,8 +30,8 @@ Import('vars') # vars is imported from arm_compute: variables = [ - BoolVariable("pmu", "Enable PMU counters", False), - BoolVariable("mali", "Enable Mali hardware counters", False), + BoolVariable("pmu", "Enable the PMU cycle counter to measure execution time in benchmark tests. (Your device needs to support it)", False), + BoolVariable("mali", "Enable the collection of Arm® Mali™ hardware counters to measure execution time in benchmark tests. (Your device needs to have a Arm® Mali™ driver that supports it)", False), ] # We need a separate set of Variables for the Help message (Otherwise the global variables will get displayed twice) @@ -47,11 +50,6 @@ Help(new_options.GenerateHelpText(framework_env)) if(env['opencl']): framework_env.Append(CPPDEFINES=['ARM_COMPUTE_CL']) -if(env['gles_compute']): - framework_env.Append(CPPDEFINES=['ARM_COMPUTE_GC']) - if env['os'] != 'android': - framework_env.Append(CPPPATH = ["#opengles-3.1/include", "#opengles-3.1/mali_include"]) - framework_env.Append(CPPPATH = ["."]) framework_env.Append(CPPFLAGS=['-Wno-overloaded-virtual']) @@ -72,7 +70,7 @@ if not env['opencl']: files = [f for f in files if "OpenCL" not in os.path.basename(str(f))] if not framework_env['mali']: - # Remove MALI files + # Remove Arm® Mali™ files files = [f for f in files if "MaliCounter" not in os.path.basename(str(f))] else: framework_env.Append(CPPDEFINES = ['MALI_ENABLED']) diff --git a/tests/framework/TestCase.h b/tests/framework/TestCase.h index d7bf54d2fc..7424fe7989 100644 --- a/tests/framework/TestCase.h +++ b/tests/framework/TestCase.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/TestCaseFactory.h b/tests/framework/TestCaseFactory.h index afd881e25b..a41226af24 100644 --- a/tests/framework/TestCaseFactory.h +++ b/tests/framework/TestCaseFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 ARM Limited. + * Copyright (c) 2017-2020 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -26,7 +26,6 @@ #include "DatasetModes.h" #include "TestCase.h" -#include "support/MemorySupport.h" #include <memory> #include <string> @@ -183,7 +182,7 @@ inline ::std::ostream &operator<<(::std::ostream &stream, TestCaseFactory::Statu template <typename T> inline std::unique_ptr<TestCase> SimpleTestCaseFactory<T>::make() const { - return support::cpp14::make_unique<T>(); + return std::make_unique<T>(); } template <typename T, typename D> @@ -195,7 +194,7 @@ inline DataTestCaseFactory<T, D>::DataTestCaseFactory(std::string suite_name, st template <typename T, typename D> inline std::unique_ptr<TestCase> DataTestCaseFactory<T, D>::make() const { - return support::cpp14::make_unique<T>(_data); + return std::make_unique<T>(_data); } } // namespace framework } // namespace test diff --git a/tests/framework/TestFilter.cpp b/tests/framework/TestFilter.cpp index cd4aa38aa1..f3127f330f 100644 --- a/tests/framework/TestFilter.cpp +++ b/tests/framework/TestFilter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 ARM Limited. + * Copyright (c) 2017-2020 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/TestFilter.h b/tests/framework/TestFilter.h index f64e73a2ba..97bce7a4d5 100644 --- a/tests/framework/TestFilter.h +++ b/tests/framework/TestFilter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/TestResult.h b/tests/framework/TestResult.h index cdace17047..18e54343dc 100644 --- a/tests/framework/TestResult.h +++ b/tests/framework/TestResult.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018,2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -73,6 +73,7 @@ struct TestResult Status status{ Status::NOT_RUN }; /**< Execution status */ Profiler::MeasurementsMap measurements{}; /**< Profiling information */ + std::string header_data{}; /**< Test header data */ }; } // namespace framework } // namespace test diff --git a/tests/framework/Utils.cpp b/tests/framework/Utils.cpp index 589d27493c..1e25893d93 100644 --- a/tests/framework/Utils.cpp +++ b/tests/framework/Utils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 ARM Limited. + * Copyright (c) 2019-2020 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/Utils.h b/tests/framework/Utils.h index 3f1d0ead53..58d4e62c94 100644 --- a/tests/framework/Utils.h +++ b/tests/framework/Utils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 ARM Limited. + * Copyright (c) 2017-2020 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/command_line/CommonOptions.cpp b/tests/framework/command_line/CommonOptions.cpp index fee18f6386..e6f1929bb1 100644 --- a/tests/framework/command_line/CommonOptions.cpp +++ b/tests/framework/command_line/CommonOptions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2020,2024 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -25,7 +25,9 @@ #include "../Framework.h" #include "../printers/Printers.h" +#if !defined(_WIN64) #include <unistd.h> +#endif // !defined(_WIN64) using namespace arm_compute::utils; @@ -43,7 +45,11 @@ CommonOptions::CommonOptions(CommandLineParser &parser) log_file(parser.add_option<SimpleOption<std::string>>("log-file")), log_level(), throw_errors(parser.add_option<ToggleOption>("throw-errors")), - color_output(parser.add_option<ToggleOption>("color-output", isatty(STDOUT_FILENO))), // Only enable colors by default if we're running in a terminal +#if !defined(_WIN64) + color_output(parser.add_option<ToggleOption>("color-output", isatty(STDOUT_FILENO))), // Only enable colors by default if we're running in a terminal +#else // !defined(_WIN64) + color_output(parser.add_option<ToggleOption>("color-output", 0)), +#endif // !defined(_WIN64) pretty_console(parser.add_option<ToggleOption>("pretty-console", false)), json_file(parser.add_option<SimpleOption<std::string>>("json-file")), pretty_file(parser.add_option<SimpleOption<std::string>>("pretty-file")), @@ -101,7 +107,7 @@ std::vector<std::unique_ptr<Printer>> CommonOptions::create_printers() if(pretty_console->value() && (log_file->is_set() || log_format->value() != LogFormat::PRETTY)) { - auto pretty_printer = support::cpp14::make_unique<PrettyPrinter>(); + auto pretty_printer = std::make_unique<PrettyPrinter>(); pretty_printer->set_color_output(color_output->value()); printers.push_back(std::move(pretty_printer)); } @@ -110,13 +116,13 @@ std::vector<std::unique_ptr<Printer>> CommonOptions::create_printers() switch(log_format->value()) { case LogFormat::JSON: - printer = support::cpp14::make_unique<JSONPrinter>(); + printer = std::make_unique<JSONPrinter>(); break; case LogFormat::NONE: break; case LogFormat::PRETTY: default: - auto pretty_printer = support::cpp14::make_unique<PrettyPrinter>(); + auto pretty_printer = std::make_unique<PrettyPrinter>(); // Don't use colours if we print to a file: pretty_printer->set_color_output((!log_file->is_set()) && color_output->value()); printer = std::move(pretty_printer); @@ -139,14 +145,14 @@ std::vector<std::unique_ptr<Printer>> CommonOptions::create_printers() if(json_file->is_set()) { - printers.push_back(support::cpp14::make_unique<JSONPrinter>()); + printers.push_back(std::make_unique<JSONPrinter>()); log_streams.push_back(std::make_shared<std::ofstream>(json_file->value())); printers.back()->set_stream(*log_streams.back().get()); } if(pretty_file->is_set()) { - printers.push_back(support::cpp14::make_unique<PrettyPrinter>()); + printers.push_back(std::make_unique<PrettyPrinter>()); log_streams.push_back(std::make_shared<std::ofstream>(pretty_file->value())); printers.back()->set_stream(*log_streams.back().get()); } diff --git a/tests/framework/command_line/CommonOptions.h b/tests/framework/command_line/CommonOptions.h index f4646a0299..e332d5f3a4 100644 --- a/tests/framework/command_line/CommonOptions.h +++ b/tests/framework/command_line/CommonOptions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/datasets/CartesianProductDataset.h b/tests/framework/datasets/CartesianProductDataset.h index b2790d7525..7b3ff12047 100644 --- a/tests/framework/datasets/CartesianProductDataset.h +++ b/tests/framework/datasets/CartesianProductDataset.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018, 2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -186,6 +186,20 @@ CartesianProductDataset<T, U> combine(T &&dataset1, U &&dataset2) * * @param[in] dataset1 First dataset. * @param[in] dataset2 Second dataset. + * @param[in] datasets Subsequent dataset. + * + * @return A grid dataset. + */ +template <typename T1, typename T2, typename... Ts> +auto combine(T1 &&dataset1, T2 &&dataset2, Ts &&... datasets) -> decltype(combine(std::forward<T1>(dataset1), combine(std::forward<T2>(dataset2), std::forward<Ts>(datasets)...))) +{ + return combine(std::forward<T1>(dataset1), combine(std::forward<T2>(dataset2), std::forward<Ts>(datasets)...)); +} + +/** Helper function to create a @ref CartesianProductDataset. + * + * @param[in] dataset1 First dataset. + * @param[in] dataset2 Second dataset. * * @return A grid dataset. */ diff --git a/tests/framework/datasets/ContainerDataset.h b/tests/framework/datasets/ContainerDataset.h index bd63fb8b92..de77cb24d6 100644 --- a/tests/framework/datasets/ContainerDataset.h +++ b/tests/framework/datasets/ContainerDataset.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 ARM Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -26,7 +26,6 @@ #include "Dataset.h" #include "support/StringSupport.h" -#include "tests/TypePrinter.h" #include <string> #include <tuple> diff --git a/tests/framework/datasets/Dataset.h b/tests/framework/datasets/Dataset.h index 5fcdc49e01..aea3e09381 100644 --- a/tests/framework/datasets/Dataset.h +++ b/tests/framework/datasets/Dataset.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/datasets/Datasets.h b/tests/framework/datasets/Datasets.h index c0e5822e17..d967f8af19 100644 --- a/tests/framework/datasets/Datasets.h +++ b/tests/framework/datasets/Datasets.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/datasets/InitializerListDataset.h b/tests/framework/datasets/InitializerListDataset.h index ec1550df4d..87aae5f308 100644 --- a/tests/framework/datasets/InitializerListDataset.h +++ b/tests/framework/datasets/InitializerListDataset.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/datasets/JoinDataset.h b/tests/framework/datasets/JoinDataset.h index bf504ec3ce..d651ac5129 100644 --- a/tests/framework/datasets/JoinDataset.h +++ b/tests/framework/datasets/JoinDataset.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/datasets/RangeDataset.h b/tests/framework/datasets/RangeDataset.h index 1adf1834ac..7935b4cfce 100644 --- a/tests/framework/datasets/RangeDataset.h +++ b/tests/framework/datasets/RangeDataset.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 ARM Limited. + * Copyright (c) 2017-2020 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/datasets/SingletonDataset.h b/tests/framework/datasets/SingletonDataset.h index e0653b74be..a9b7187758 100644 --- a/tests/framework/datasets/SingletonDataset.h +++ b/tests/framework/datasets/SingletonDataset.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 ARM Limited. + * Copyright (c) 2017-2020 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/datasets/ZipDataset.h b/tests/framework/datasets/ZipDataset.h index 3d93b92506..0b963484c5 100644 --- a/tests/framework/datasets/ZipDataset.h +++ b/tests/framework/datasets/ZipDataset.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018, 2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -150,6 +150,20 @@ ZipDataset<T, U> zip(T &&dataset1, U &&dataset2) { return ZipDataset<T, U>(std::forward<T>(dataset1), std::forward<U>(dataset2)); } + +/** Helper function to create a @ref ZipDataset. + * + * @param[in] dataset1 First dataset. + * @param[in] dataset2 Second dataset. + * @param[in] datasets Subsequent datasets. + * + * @return A zip dataset. + */ +template <typename T1, typename T2, typename... Ts> +auto zip(T1 &&dataset1, T2 &&dataset2, Ts &&... datasets) -> decltype(zip(std::forward<T1>(dataset1), zip(std::forward<T2>(dataset2), std::forward<Ts>(datasets)...))) +{ + return zip(std::forward<T1>(dataset1), zip(std::forward<T2>(dataset2), std::forward<Ts>(datasets)...)); +} } // namespace dataset } // namespace framework } // namespace test diff --git a/tests/framework/instruments/Instrument.h b/tests/framework/instruments/Instrument.h index 301ca2fc1b..1770a492ac 100644 --- a/tests/framework/instruments/Instrument.h +++ b/tests/framework/instruments/Instrument.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 ARM Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -24,8 +24,6 @@ #ifndef ARM_COMPUTE_TEST_INSTRUMENT #define ARM_COMPUTE_TEST_INSTRUMENT -#include "support/MemorySupport.h" - #include "../Utils.h" #include "Measurement.h" @@ -119,6 +117,15 @@ public: return MeasurementsMap(); } + /** Return JSON formatted instrument header string. + * + * @return JSON formatted string + */ + virtual std::string instrument_header() const + { + return std::string{}; + } + /** Return the latest test measurements. * * @return the latest test measurements. @@ -135,7 +142,7 @@ protected: template <typename T, ScaleFactor scale> inline std::unique_ptr<Instrument> Instrument::make_instrument() { - return support::cpp14::make_unique<T>(scale); + return std::make_unique<T>(scale); } } // namespace framework diff --git a/tests/framework/instruments/Instruments.cpp b/tests/framework/instruments/Instruments.cpp index 2288124a21..7834feaa44 100644 --- a/tests/framework/instruments/Instruments.cpp +++ b/tests/framework/instruments/Instruments.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/instruments/Instruments.h b/tests/framework/instruments/Instruments.h index 8adf501c18..d80032a032 100644 --- a/tests/framework/instruments/Instruments.h +++ b/tests/framework/instruments/Instruments.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -24,12 +24,12 @@ #ifndef ARM_COMPUTE_TEST_INSTRUMENTS #define ARM_COMPUTE_TEST_INSTRUMENTS -#if !defined(BARE_METAL) +#if !defined(_WIN64) && !defined(BARE_METAL) && !defined(__APPLE__) && !defined(__OpenBSD__) #include "MaliCounter.h" #include "OpenCLMemoryUsage.h" #include "OpenCLTimer.h" #include "PMUCounter.h" -#endif /* !defined(BARE_METAL) */ +#endif /* !defined(_WIN64) && !defined(BARE_METAL) && !defined(__APPLE__) && !defined(__OpenBSD__) */ #include "SchedulerTimer.h" #include "WallClockTimer.h" diff --git a/tests/framework/instruments/InstrumentsStats.cpp b/tests/framework/instruments/InstrumentsStats.cpp index 8f7d8a18e3..2bb9eed97d 100644 --- a/tests/framework/instruments/InstrumentsStats.cpp +++ b/tests/framework/instruments/InstrumentsStats.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/instruments/InstrumentsStats.h b/tests/framework/instruments/InstrumentsStats.h index f1085aafb8..aa2008ace3 100644 --- a/tests/framework/instruments/InstrumentsStats.h +++ b/tests/framework/instruments/InstrumentsStats.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/instruments/MaliCounter.cpp b/tests/framework/instruments/MaliCounter.cpp index 354c899253..a7557fc94c 100644 --- a/tests/framework/instruments/MaliCounter.cpp +++ b/tests/framework/instruments/MaliCounter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2019 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/instruments/MaliCounter.h b/tests/framework/instruments/MaliCounter.h index 94ef93fdb5..c2d1849423 100644 --- a/tests/framework/instruments/MaliCounter.h +++ b/tests/framework/instruments/MaliCounter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2019 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/instruments/Measurement.h b/tests/framework/instruments/Measurement.h index 5c62977b91..2ec68d424b 100644 --- a/tests/framework/instruments/Measurement.h +++ b/tests/framework/instruments/Measurement.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018,2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -209,10 +209,10 @@ struct Measurement /** Stored value */ union - { - double floating_point; - long long int integer; - } v; + { + double floating_point; + long long int integer; + } v; bool is_floating_point; /**< Is the stored value floating point or integer ? */ }; diff --git a/tests/framework/instruments/OpenCLMemoryUsage.cpp b/tests/framework/instruments/OpenCLMemoryUsage.cpp index 7b08e2d85b..5ed2013f3d 100644 --- a/tests/framework/instruments/OpenCLMemoryUsage.cpp +++ b/tests/framework/instruments/OpenCLMemoryUsage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 ARM Limited. + * Copyright (c) 2018-2019 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/instruments/OpenCLMemoryUsage.h b/tests/framework/instruments/OpenCLMemoryUsage.h index 7593c01e63..07b6544f51 100644 --- a/tests/framework/instruments/OpenCLMemoryUsage.h +++ b/tests/framework/instruments/OpenCLMemoryUsage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/instruments/OpenCLTimer.cpp b/tests/framework/instruments/OpenCLTimer.cpp index ca4c13ce61..e9f945bd95 100644 --- a/tests/framework/instruments/OpenCLTimer.cpp +++ b/tests/framework/instruments/OpenCLTimer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2019, 2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -54,7 +54,13 @@ std::string OpenCLClock<output_timestamps>::id() const template <bool output_timestamps> OpenCLClock<output_timestamps>::OpenCLClock(ScaleFactor scale_factor) - : _kernels(), _real_function(nullptr), _real_graph_function(nullptr), _prefix(), _timer_enabled(false) + : _kernels(), + _real_function(nullptr), +#ifdef ARM_COMPUTE_GRAPH_ENABLED + _real_graph_function(nullptr), +#endif /* ARM_COMPUTE_GRAPH_ENABLED */ + _prefix(), + _timer_enabled(false) { auto q = CLScheduler::get().queue(); cl_command_queue_properties props = q.getInfo<CL_QUEUE_PROPERTIES>(); @@ -91,19 +97,17 @@ void OpenCLClock<output_timestamps>::test_start() { // Start intercepting enqueues: ARM_COMPUTE_ERROR_ON(_real_function != nullptr); - ARM_COMPUTE_ERROR_ON(_real_graph_function != nullptr); - _real_function = CLSymbols::get().clEnqueueNDRangeKernel_ptr; - _real_graph_function = graph::TaskExecutor::get().execute_function; - auto interceptor = [this]( - cl_command_queue command_queue, - cl_kernel kernel, - cl_uint work_dim, - const size_t *gwo, - const size_t *gws, - const size_t *lws, - cl_uint num_events_in_wait_list, - const cl_event * event_wait_list, - cl_event * event) + _real_function = CLSymbols::get().clEnqueueNDRangeKernel_ptr; + auto interceptor = [this]( + cl_command_queue command_queue, + cl_kernel kernel, + cl_uint work_dim, + const size_t *gwo, + const size_t *gws, + const size_t *lws, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) { if(this->_timer_enabled) { @@ -138,7 +142,11 @@ void OpenCLClock<output_timestamps>::test_start() return this->_real_function(command_queue, kernel, work_dim, gwo, gws, lws, num_events_in_wait_list, event_wait_list, event); } }; + CLSymbols::get().clEnqueueNDRangeKernel_ptr = interceptor; +#ifdef ARM_COMPUTE_GRAPH_ENABLED + ARM_COMPUTE_ERROR_ON(_real_graph_function != nullptr); + _real_graph_function = graph::TaskExecutor::get().execute_function; // Start intercepting tasks: auto task_interceptor = [this](graph::ExecutionTask & task) { @@ -153,9 +161,8 @@ void OpenCLClock<output_timestamps>::test_start() this->_real_graph_function(task); this->_prefix = ""; }; - - CLSymbols::get().clEnqueueNDRangeKernel_ptr = interceptor; graph::TaskExecutor::get().execute_function = task_interceptor; +#endif /* ARM_COMPUTE_GRAPH_ENABLED */ } template <bool output_timestamps> @@ -175,9 +182,11 @@ void OpenCLClock<output_timestamps>::test_stop() { // Restore real function CLSymbols::get().clEnqueueNDRangeKernel_ptr = _real_function; + _real_function = nullptr; +#ifdef ARM_COMPUTE_GRAPH_ENABLED graph::TaskExecutor::get().execute_function = _real_graph_function; _real_graph_function = nullptr; - _real_function = nullptr; +#endif /* ARM_COMPUTE_GRAPH_ENABLED */ } template <bool output_timestamps> diff --git a/tests/framework/instruments/OpenCLTimer.h b/tests/framework/instruments/OpenCLTimer.h index b094ef44cb..1812272435 100644 --- a/tests/framework/instruments/OpenCLTimer.h +++ b/tests/framework/instruments/OpenCLTimer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018, 2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -67,9 +67,11 @@ private: }; std::list<kernel_info> _kernels; std::function<decltype(clEnqueueNDRangeKernel)> _real_function; - std::function<decltype(graph::execute_task)> _real_graph_function; - std::string _prefix; - bool _timer_enabled; +#ifdef ARM_COMPUTE_GRAPH_ENABLED + std::function<decltype(graph::execute_task)> _real_graph_function; +#endif /* ARM_COMPUTE_GRAPH_ENABLED */ + std::string _prefix; + bool _timer_enabled; #endif /* ARM_COMPUTE_CL */ private: diff --git a/tests/framework/instruments/PMU.cpp b/tests/framework/instruments/PMU.cpp index 053c70a83f..bb2c70e215 100644 --- a/tests/framework/instruments/PMU.cpp +++ b/tests/framework/instruments/PMU.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2019 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/instruments/PMU.h b/tests/framework/instruments/PMU.h index ef4a9a0dd0..c392a0ac66 100644 --- a/tests/framework/instruments/PMU.h +++ b/tests/framework/instruments/PMU.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2019 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/instruments/PMUCounter.cpp b/tests/framework/instruments/PMUCounter.cpp index df059fbc4e..18821b5d6f 100644 --- a/tests/framework/instruments/PMUCounter.cpp +++ b/tests/framework/instruments/PMUCounter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/instruments/PMUCounter.h b/tests/framework/instruments/PMUCounter.h index 0719b10864..7dddbbf6fa 100644 --- a/tests/framework/instruments/PMUCounter.h +++ b/tests/framework/instruments/PMUCounter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/instruments/SchedulerTimer.cpp b/tests/framework/instruments/SchedulerTimer.cpp index 9e8bba28e8..b753485351 100644 --- a/tests/framework/instruments/SchedulerTimer.cpp +++ b/tests/framework/instruments/SchedulerTimer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -26,8 +26,9 @@ #include "Instruments.h" #include "WallClockTimer.h" #include "arm_compute/core/CPP/ICPPKernel.h" -#include "arm_compute/core/utils/misc/Cast.h" +#include "arm_compute/graph/DataLayerVisitor.h" #include "arm_compute/graph/INode.h" +#include "support/Cast.h" namespace arm_compute { @@ -53,8 +54,10 @@ class Interceptor final : public IScheduler { public: /** Default constructor. */ - Interceptor(std::list<struct SchedulerClock<output_timestamps>::kernel_info> &kernels, IScheduler &real_scheduler, ScaleFactor scale_factor) - : _kernels(kernels), _real_scheduler(real_scheduler), _timer(scale_factor), _prefix() + Interceptor(std::list<struct SchedulerClock<output_timestamps>::kernel_info> &kernels, + std::map<std::string, SchedulerTimer::LayerData> &layers, IScheduler &real_scheduler, + ScaleFactor scale_factor) + : _kernels(kernels), _layer_data_map(layers), _real_scheduler(real_scheduler), _timer(scale_factor), _prefix() { } @@ -63,6 +66,11 @@ public: _real_scheduler.set_num_threads(num_threads); } + void set_num_threads_with_affinity(unsigned int num_threads, BindFunc func) override + { + _real_scheduler.set_num_threads_with_affinity(num_threads, func); + } + unsigned int num_threads() const override { return _real_scheduler.num_threads(); @@ -86,6 +94,19 @@ public: _kernels.push_back(std::move(info)); } + void schedule_op(ICPPKernel *kernel, const Hints &hints, const Window &window, ITensorPack &tensors) override + { + _timer.start(); + _real_scheduler.schedule_op(kernel, hints, window, tensors); + _timer.stop(); + + typename SchedulerClock<output_timestamps>::kernel_info info; + info.name = kernel->name(); + info.prefix = _prefix; + info.measurements = _timer.measurements(); + _kernels.push_back(std::move(info)); + } + void run_tagged_workloads(std::vector<Workload> &workloads, const char *tag) override { _timer.start(); @@ -108,14 +129,24 @@ protected: private: std::list<struct SchedulerClock<output_timestamps>::kernel_info> &_kernels; - IScheduler &_real_scheduler; - WallClock<output_timestamps> _timer; - std::string _prefix; + std::map<std::string, SchedulerTimer::LayerData> &_layer_data_map; + IScheduler &_real_scheduler; + WallClock<output_timestamps> _timer; + std::string _prefix; }; template <bool output_timestamps> SchedulerClock<output_timestamps>::SchedulerClock(ScaleFactor scale_factor) - : _kernels(), _real_scheduler(nullptr), _real_scheduler_type(), _real_graph_function(nullptr), _scale_factor(scale_factor), _interceptor(nullptr), _scheduler_users() + : _kernels(), + _layer_data_map(), + _real_scheduler(nullptr), + _real_scheduler_type(), +#ifdef ARM_COMPUTE_GRAPH_ENABLED + _real_graph_function(nullptr), +#endif /* ARM_COMPUTE_GRAPH_ENABLED */ + _scale_factor(scale_factor), + _interceptor(nullptr), + _scheduler_users() { if(instruments_info != nullptr) { @@ -126,6 +157,7 @@ SchedulerClock<output_timestamps>::SchedulerClock(ScaleFactor scale_factor) template <bool output_timestamps> void SchedulerClock<output_timestamps>::test_start() { +#ifdef ARM_COMPUTE_GRAPH_ENABLED // Start intercepting tasks: ARM_COMPUTE_ERROR_ON(_real_graph_function != nullptr); _real_graph_function = graph::TaskExecutor::get().execute_function; @@ -138,6 +170,13 @@ void SchedulerClock<output_timestamps>::test_start() if(task.node != nullptr && !task.node->name().empty()) { scheduler->set_prefix(task.node->name() + "/"); + + if(_layer_data_map.find(task.node->name()) == _layer_data_map.end()) + { + arm_compute::graph::DataLayerVisitor dlv = {}; + task.node->accept(dlv); + _layer_data_map[task.node->name()] = dlv.layer_data(); + } } else { @@ -152,6 +191,7 @@ void SchedulerClock<output_timestamps>::test_start() scheduler->set_prefix(""); } }; +#endif /* ARM_COMPUTE_GRAPH_ENABLED */ ARM_COMPUTE_ERROR_ON(_real_scheduler != nullptr); _real_scheduler_type = Scheduler::get_type(); @@ -159,9 +199,11 @@ void SchedulerClock<output_timestamps>::test_start() if(_real_scheduler_type != Scheduler::Type::CUSTOM) { _real_scheduler = &Scheduler::get(); - _interceptor = std::make_shared<Interceptor<output_timestamps>>(_kernels, *_real_scheduler, _scale_factor); + _interceptor = std::make_shared<Interceptor<output_timestamps>>(_kernels, _layer_data_map, *_real_scheduler, _scale_factor); Scheduler::set(std::static_pointer_cast<IScheduler>(_interceptor)); +#ifdef ARM_COMPUTE_GRAPH_ENABLED graph::TaskExecutor::get().execute_function = task_interceptor; +#endif /* ARM_COMPUTE_GRAPH_ENABLED */ // Create an interceptor for each scheduler // TODO(COMPID-2638) : Allow multiple schedulers, now it assumes the same scheduler is used. @@ -170,7 +212,7 @@ void SchedulerClock<output_timestamps>::test_start() { if(user != nullptr && user->scheduler() != nullptr) { - user->intercept_scheduler(support::cpp14::make_unique<Interceptor<output_timestamps>>(_kernels, *user->scheduler(), _scale_factor)); + user->intercept_scheduler(std::make_unique<Interceptor<output_timestamps>>(_kernels, _layer_data_map, *user->scheduler(), _scale_factor)); } }); } @@ -187,10 +229,12 @@ void SchedulerClock<output_timestamps>::test_stop() { // Restore real scheduler Scheduler::set(_real_scheduler_type); - _real_scheduler = nullptr; - _interceptor = nullptr; + _real_scheduler = nullptr; + _interceptor = nullptr; +#ifdef ARM_COMPUTE_GRAPH_ENABLED graph::TaskExecutor::get().execute_function = _real_graph_function; _real_graph_function = nullptr; +#endif /* ARM_COMPUTE_GRAPH_ENABLED */ // Restore schedulers std::for_each(std::begin(_scheduler_users), std::end(_scheduler_users), @@ -239,6 +283,36 @@ Instrument::MeasurementsMap SchedulerClock<output_timestamps>::measurements() co return measurements; } +template <bool output_timestamps> +std::string SchedulerClock<output_timestamps>::instrument_header() const +{ + std::string output{ "" }; + output += R"("layer_data" : {)"; + for(auto i_it = _layer_data_map.cbegin(), i_end = _layer_data_map.cend(); i_it != i_end; ++i_it) + { + output += "\"" + i_it->first + "\" : {"; + if(i_it->second.size() != 0) + { + // Print for each entry in layer + for(auto entry_it = i_it->second.cbegin(), entry_end = i_it->second.cend(); entry_it != entry_end; ++entry_it) + { + output += "\"" + entry_it->first + "\" : \"" + entry_it->second + "\""; + if(std::next(entry_it) != entry_end) + { + output += ","; + } + } + } + output += "}"; + if(std::next(i_it) != i_end) + { + output += ","; + } + } + output += "}"; + return output; +} + } // namespace framework } // namespace test } // namespace arm_compute diff --git a/tests/framework/instruments/SchedulerTimer.h b/tests/framework/instruments/SchedulerTimer.h index ea64b227eb..c437f2717c 100644 --- a/tests/framework/instruments/SchedulerTimer.h +++ b/tests/framework/instruments/SchedulerTimer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2019,2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -63,6 +63,7 @@ template <bool output_timestamps> class SchedulerClock : public Instrument { public: + using LayerData = std::map<std::string, std::string>; /** Construct a Scheduler timer. * * @param[in] scale_factor Measurement scale factor. @@ -85,6 +86,7 @@ public: void start() override; void test_stop() override; Instrument::MeasurementsMap measurements() const override; + std::string instrument_header() const override; /** Kernel information */ struct kernel_info @@ -95,13 +97,16 @@ public: }; private: - std::list<kernel_info> _kernels; - IScheduler *_real_scheduler; - Scheduler::Type _real_scheduler_type; + std::list<kernel_info> _kernels; + std::map<std::string, LayerData> _layer_data_map; + IScheduler *_real_scheduler; + Scheduler::Type _real_scheduler_type; +#ifdef ARM_COMPUTE_GRAPH_ENABLED std::function<decltype(graph::execute_task)> _real_graph_function; - ScaleFactor _scale_factor; - std::shared_ptr<IScheduler> _interceptor; - std::vector<ISchedulerUser *> _scheduler_users; +#endif /* ARM_COMPUTE_GRAPH_ENABLED */ + ScaleFactor _scale_factor; + std::shared_ptr<IScheduler> _interceptor; + std::vector<ISchedulerUser *> _scheduler_users; }; using SchedulerTimer = SchedulerClock<false>; diff --git a/tests/framework/instruments/WallClockTimer.cpp b/tests/framework/instruments/WallClockTimer.cpp index 0e21ac71fb..763fb9ab27 100644 --- a/tests/framework/instruments/WallClockTimer.cpp +++ b/tests/framework/instruments/WallClockTimer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -48,13 +48,44 @@ std::string WallClock<output_timestamps>::id() const template <bool output_timestamps> void WallClock<output_timestamps>::start() { +#if defined(BARE_METAL) + uint64_t tmp; + uint64_t retval; + + __asm __volatile( + "mrs %[tmp], pmcr_el0\n" + "orr %[tmp], %[tmp], #1\n" + "msr pmcr_el0, %[tmp]\n" + "mrs %[tmp], pmcntenset_el0\n" + "orr %[tmp], %[tmp], #1<<31\n" + "msr pmcntenset_el0, %[tmp]\n" + "mrs %[retval], pmccntr_el0\n" + : [tmp] "=r"(tmp), [retval] "=r"(retval)); + + _start = retval; +#else // !defined(BARE_METAL) _start = std::chrono::system_clock::now(); +#endif // defined(BARE_METAL) } template <bool output_timestamps> void WallClock<output_timestamps>::stop() { +#if defined(BARE_METAL) + uint64_t tmp; + uint64_t retval; + + __asm __volatile( + "mrs %[retval], pmccntr_el0\n" + "mov %[tmp], #0x3f\n" + "orr %[tmp], %[tmp], #1<<31\n" + "msr pmcntenclr_el0, %[tmp]\n" + : [tmp] "=r"(tmp), [retval] "=r"(retval)); + + _stop = retval; +#else // !defined(BARE_METAL) _stop = std::chrono::system_clock::now(); +#endif // defined(BARE_METAL) } template <bool output_timestamps> @@ -63,14 +94,23 @@ Instrument::MeasurementsMap WallClock<output_timestamps>::measurements() const MeasurementsMap measurements; if(output_timestamps) { - // _start / _stop are in ns, so divide by an extra 1000: +#if defined(BARE_METAL) + measurements.emplace("[start]Wall clock time", Measurement(_start / static_cast<uint64_t>(_scale_factor), _unit)); + measurements.emplace("[end]Wall clock time", Measurement(_stop / static_cast<uint64_t>(_scale_factor), _unit)); +#else // !defined(BARE_METAL) measurements.emplace("[start]Wall clock time", Measurement(_start.time_since_epoch().count() / static_cast<uint64_t>(1000 * _scale_factor), _unit)); measurements.emplace("[end]Wall clock time", Measurement(_stop.time_since_epoch().count() / static_cast<uint64_t>(1000 * _scale_factor), _unit)); +#endif // defined(BARE_METAL) } else { +#if defined(BARE_METAL) + const double delta = _stop - _start; + measurements.emplace("Wall clock time", Measurement(delta / static_cast<double>(1000 * _scale_factor), _unit)); +#else // !defined(BARE_METAL) const auto delta = std::chrono::duration_cast<std::chrono::microseconds>(_stop - _start); measurements.emplace("Wall clock time", Measurement(delta.count() / _scale_factor, _unit)); +#endif // defined(BARE_METAL) } return measurements; } diff --git a/tests/framework/instruments/WallClockTimer.h b/tests/framework/instruments/WallClockTimer.h index fb047aa7e4..b1d7531f4e 100644 --- a/tests/framework/instruments/WallClockTimer.h +++ b/tests/framework/instruments/WallClockTimer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -70,9 +70,14 @@ public: MeasurementsMap measurements() const override; private: - std::chrono::system_clock::time_point _start{}; +#if defined(BARE_METAL) + uint64_t _start {}; + uint64_t _stop{}; +#else // !defined(BARE_METAL) + std::chrono::system_clock::time_point _start {}; std::chrono::system_clock::time_point _stop{}; - float _scale_factor{}; +#endif // defined(BARE_METAL) + float _scale_factor {}; }; using WallClockTimer = WallClock<false>; diff --git a/tests/framework/instruments/hwc.hpp b/tests/framework/instruments/hwc.hpp index 8c48e0ca45..5d12a40217 100644 --- a/tests/framework/instruments/hwc.hpp +++ b/tests/framework/instruments/hwc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/instruments/hwc_names.hpp b/tests/framework/instruments/hwc_names.hpp index cbcb0e788e..c39f3bba7a 100644 --- a/tests/framework/instruments/hwc_names.hpp +++ b/tests/framework/instruments/hwc_names.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -44,7 +44,7 @@ enum /* * "Short names" for hardware counters used by Streamline. Counters names are * stored in accordance with their memory layout in the binary counter block - * emitted by the Mali GPU. Each "master" in the GPU emits a fixed-size block + * emitted by the Arm® Mali™ GPU. Each "master" in the GPU emits a fixed-size block * of 64 counters, and each GPU implements the same set of "masters" although * the counters each master exposes within its block of 64 may vary. * diff --git a/tests/framework/printers/JSONPrinter.cpp b/tests/framework/printers/JSONPrinter.cpp index 179cdf9601..84b2d23114 100644 --- a/tests/framework/printers/JSONPrinter.cpp +++ b/tests/framework/printers/JSONPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2019,2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -169,10 +169,18 @@ void JSONPrinter::print_info(const std::string &info) _infos.push_back(info); } +void JSONPrinter::print_profiler_header(const std::string &header_data) +{ + if(header_data.size() > 0) + { + print_separator(_first_test_entry); + } + *_stream << header_data; +} + void JSONPrinter::print_measurements(const Profiler::MeasurementsMap &measurements) { print_separator(_first_test_entry); - *_stream << R"("measurements" : {)"; for(auto i_it = measurements.cbegin(), i_end = measurements.cend(); i_it != i_end;) diff --git a/tests/framework/printers/JSONPrinter.h b/tests/framework/printers/JSONPrinter.h index 3b783ac64f..ad996708e7 100644 --- a/tests/framework/printers/JSONPrinter.h +++ b/tests/framework/printers/JSONPrinter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017,2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -51,6 +51,7 @@ public: void print_errors_footer() override; void print_error(const std::exception &error, bool expected) override; void print_info(const std::string &info) override; + void print_profiler_header(const std::string &header_data) override; void print_measurements(const Profiler::MeasurementsMap &measurements) override; void print_list_tests(const std::vector<TestInfo> &infos) override; diff --git a/tests/framework/printers/PrettyPrinter.cpp b/tests/framework/printers/PrettyPrinter.cpp index fe0540a624..529ff2c2d9 100644 --- a/tests/framework/printers/PrettyPrinter.cpp +++ b/tests/framework/printers/PrettyPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2019,2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -116,6 +116,12 @@ void PrettyPrinter::print_list_tests(const std::vector<TestInfo> &infos) *_stream << "[" << info.id << ", " << info.mode << ", " << info.status << "] " << info.name << "\n"; } } + +void PrettyPrinter::print_profiler_header(const std::string &header_data) +{ + ARM_COMPUTE_UNUSED(header_data); +} + void PrettyPrinter::print_measurements(const Profiler::MeasurementsMap &measurements) { for(const auto &instrument : measurements) diff --git a/tests/framework/printers/PrettyPrinter.h b/tests/framework/printers/PrettyPrinter.h index 95487f94c5..b9d5d3957c 100644 --- a/tests/framework/printers/PrettyPrinter.h +++ b/tests/framework/printers/PrettyPrinter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017,2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -55,6 +55,7 @@ public: void print_errors_footer() override; void print_error(const std::exception &error, bool expected) override; void print_info(const std::string &info) override; + void print_profiler_header(const std::string &header_data) override; void print_measurements(const Profiler::MeasurementsMap &measurements) override; void print_list_tests(const std::vector<TestInfo> &infos) override; diff --git a/tests/framework/printers/Printer.cpp b/tests/framework/printers/Printer.cpp index e034c2ed43..12e2460aef 100644 --- a/tests/framework/printers/Printer.cpp +++ b/tests/framework/printers/Printer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/printers/Printer.h b/tests/framework/printers/Printer.h index cbe22fb2a6..af0209788c 100644 --- a/tests/framework/printers/Printer.h +++ b/tests/framework/printers/Printer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2018,2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -125,6 +125,12 @@ public: */ virtual void print_info(const std::string &info) = 0; + /** Print header data. + * + * @param[in] header_data JSON formmated header data. + */ + virtual void print_profiler_header(const std::string &header_data) = 0; + /** Print measurements for a test. * * @param[in] measurements Measurements as collected by a @ref Profiler. diff --git a/tests/framework/printers/Printers.cpp b/tests/framework/printers/Printers.cpp index 6e11b63a9a..9ba3098432 100644 --- a/tests/framework/printers/Printers.cpp +++ b/tests/framework/printers/Printers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/framework/printers/Printers.h b/tests/framework/printers/Printers.h index 53867e2dff..acbddf0bd4 100644 --- a/tests/framework/printers/Printers.h +++ b/tests/framework/printers/Printers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017 Arm Limited. * * SPDX-License-Identifier: MIT * |