| 186 | |
| 187 | template <bool output_timestamps> |
| 188 | Instrument::MeasurementsMap OpenCLClock<output_timestamps>::measurements() const |
| 189 | { |
| 190 | MeasurementsMap measurements; |
| 191 | unsigned int kernel_number = 0; |
| 192 | for (auto const &kernel : _kernels) |
| 193 | { |
| 194 | cl_ulong queued; |
| 195 | cl_ulong flushed; |
| 196 | cl_ulong start; |
| 197 | cl_ulong end; |
| 198 | kernel.event.getProfilingInfo(CL_PROFILING_COMMAND_QUEUED, &queued); |
| 199 | kernel.event.getProfilingInfo(CL_PROFILING_COMMAND_SUBMIT, &flushed); |
| 200 | kernel.event.getProfilingInfo(CL_PROFILING_COMMAND_START, &start); |
| 201 | kernel.event.getProfilingInfo(CL_PROFILING_COMMAND_END, &end); |
| 202 | std::string name = kernel.name + " #" + support::cpp11::to_string(kernel_number++); |
| 203 | |
| 204 | if (output_timestamps) |
| 205 | { |
| 206 | measurements.emplace("[start]" + name, Measurement(start / static_cast<cl_ulong>(_scale_factor), _unit)); |
| 207 | measurements.emplace("[queued]" + name, Measurement(queued / static_cast<cl_ulong>(_scale_factor), _unit)); |
| 208 | measurements.emplace("[flushed]" + name, |
| 209 | Measurement(flushed / static_cast<cl_ulong>(_scale_factor), _unit)); |
| 210 | measurements.emplace("[end]" + name, Measurement(end / static_cast<cl_ulong>(_scale_factor), _unit)); |
| 211 | } |
| 212 | else |
| 213 | { |
| 214 | measurements.emplace(name, Measurement((end - start) / _scale_factor, _unit)); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | return measurements; |
| 219 | } |
| 220 | |
| 221 | template <bool output_timestamps> |
| 222 | Instrument::MeasurementsMap OpenCLClock<output_timestamps>::test_measurements() const |
nothing calls this directly
no test coverage detected