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

Method test_measurements

tests/framework/instruments/OpenCLTimer.cpp:222–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220
221template <bool output_timestamps>
222Instrument::MeasurementsMap OpenCLClock<output_timestamps>::test_measurements() const
223{
224 MeasurementsMap measurements;
225
226 if (output_timestamps)
227 {
228 // The OpenCL clock and the wall clock are not in sync, so we use
229 // this trick to calculate the offset between the two clocks:
230 ::cl::Event event;
231 cl_ulong now_gpu;
232
233 // Enqueue retrieve current CPU clock and enqueue a dummy marker
234 std::chrono::high_resolution_clock::time_point now_cpu = std::chrono::high_resolution_clock::now();
235 CLScheduler::get().queue().enqueueMarker(&event);
236
237 CLScheduler::get().queue().finish();
238 //Access the time at which the marker was enqueued:
239 event.getProfilingInfo(CL_PROFILING_COMMAND_QUEUED, &now_gpu);
240
241 measurements.emplace("Now Wall clock", Measurement(now_cpu.time_since_epoch().count() / 1000, "us"));
242 measurements.emplace("Now OpenCL", Measurement(now_gpu / static_cast<cl_ulong>(_scale_factor), _unit));
243 }
244
245 return measurements;
246}
247
248} // namespace framework
249} // namespace test

Callers 1

test_stopMethod · 0.45

Calls 3

getProfilingInfoMethod · 0.80
MeasurementClass · 0.70
finishMethod · 0.45

Tested by

no test coverage detected