MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / OpenCLClock

Method OpenCLClock

tests/framework/instruments/OpenCLTimer.cpp:56–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54
55template <bool output_timestamps>
56OpenCLClock<output_timestamps>::OpenCLClock(ScaleFactor scale_factor)
57 : _kernels(),
58 _real_function(nullptr),
59#ifdef ARM_COMPUTE_GRAPH_ENABLED
60 _real_graph_function(nullptr),
61#endif /* ARM_COMPUTE_GRAPH_ENABLED */
62 _prefix(),
63 _timer_enabled(false)
64{
65 auto q = CLScheduler::get().queue();
66 cl_command_queue_properties props = q.getInfo<CL_QUEUE_PROPERTIES>();
67 if ((props & CL_QUEUE_PROFILING_ENABLE) == 0)
68 {
69 CLScheduler::get().set_queue(cl::CommandQueue(CLScheduler::get().context(), props | CL_QUEUE_PROFILING_ENABLE));
70 }
71
72 switch (scale_factor)
73 {
74 case ScaleFactor::NONE:
75 _scale_factor = 1.f;
76 _unit = "ns";
77 break;
78 case ScaleFactor::TIME_US:
79 _scale_factor = 1000.f;
80 _unit = "us";
81 break;
82 case ScaleFactor::TIME_MS:
83 _scale_factor = 1000000.f;
84 _unit = "ms";
85 break;
86 case ScaleFactor::TIME_S:
87 _scale_factor = 1000000000.f;
88 _unit = "s";
89 break;
90 default:
91 ARM_COMPUTE_ERROR("Invalid scale");
92 }
93}
94
95template <bool output_timestamps>
96void OpenCLClock<output_timestamps>::test_start()

Callers

nothing calls this directly

Calls 3

set_queueMethod · 0.80
contextMethod · 0.80
CommandQueueClass · 0.50

Tested by

no test coverage detected