aboutsummaryrefslogtreecommitdiff
path: root/tests/framework/instruments/OpenCLTimer.h
diff options
context:
space:
mode:
authorAnthony Barbier <anthony.barbier@arm.com>2017-11-09 15:52:00 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commit6e4334962913a4b4d88d3d2b9d76ef2b7850a56c (patch)
treec04a97710320f0650db3c68dc722474a0abf03ea /tests/framework/instruments/OpenCLTimer.h
parent9c45f56439f5a4aef68901dfe4b7b57d2a7ce85e (diff)
downloadComputeLibrary-6e4334962913a4b4d88d3d2b9d76ef2b7850a56c.tar.gz
COMPMID-663 Adding instrument to return timestamps of clGetEventProfilingInfo
Change-Id: I1037054615593205f07e25fb9b16fecd13407c2c Reviewed-on: http://mpd-gerrit.cambridge.arm.com/95142 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'tests/framework/instruments/OpenCLTimer.h')
-rw-r--r--tests/framework/instruments/OpenCLTimer.h63
1 files changed, 63 insertions, 0 deletions
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 <list>
+
+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<kernel_info> kernels{};
+ std::function<decltype(clEnqueueNDRangeKernel)> real_function;
+#endif /* ARM_COMPUTE_CL */
+};
+} // namespace framework
+} // namespace test
+} // namespace arm_compute
+#endif /* ARM_COMPUTE_TEST_OPENCL_TIMER */