From 6e4334962913a4b4d88d3d2b9d76ef2b7850a56c Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Thu, 9 Nov 2017 15:52:00 +0000 Subject: COMPMID-663 Adding instrument to return timestamps of clGetEventProfilingInfo Change-Id: I1037054615593205f07e25fb9b16fecd13407c2c Reviewed-on: http://mpd-gerrit.cambridge.arm.com/95142 Tested-by: Kaizen Reviewed-by: Georgios Pinitas --- tests/framework/instruments/OpenCLTimer.h | 63 +++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 tests/framework/instruments/OpenCLTimer.h (limited to 'tests/framework/instruments/OpenCLTimer.h') diff --git a/tests/framework/instruments/OpenCLTimer.h b/tests/framework/instruments/OpenCLTimer.h new file mode 100644 index 0000000000..d00a2e8bf2 --- /dev/null +++ b/tests/framework/instruments/OpenCLTimer.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2017 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. + */ +#ifndef ARM_COMPUTE_TEST_OPENCL_TIMER +#define ARM_COMPUTE_TEST_OPENCL_TIMER + +#include "Instrument.h" + +#ifdef ARM_COMPUTE_CL +#include "arm_compute/core/CL/OpenCL.h" +#endif /* ARM_COMPUTE_CL */ + +#include + +namespace arm_compute +{ +namespace test +{ +namespace framework +{ +/** Instrument creating measurements based on the information returned by clGetEventProfilingInfo for each OpenCL kernel executed*/ +class OpenCLTimer : public Instrument +{ +public: + OpenCLTimer(); + std::string id() const override; + void start() override; + void stop() override; + MeasurementsMap measurements() const override; +#ifdef ARM_COMPUTE_CL + struct kernel_info + { + cl::Event event{}; /**< OpenCL event associated to the kernel enqueue */ + std::string name{}; /**< OpenCL Kernel name */ + }; + std::list kernels{}; + std::function real_function; +#endif /* ARM_COMPUTE_CL */ +}; +} // namespace framework +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_OPENCL_TIMER */ -- cgit v1.2.1