File size: 462 Bytes
833d7c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once

// OpenCL SDK includes
#include "OpenCLUtilsCpp_Export.h"

// STL includes
#include <chrono>

// OpenCL includes
#include <CL/opencl.hpp>

namespace cl {
namespace util {
    template <cl_int From, cl_int To, typename Dur = std::chrono::nanoseconds>
    auto get_duration(cl::Event& ev)
    {
        return std::chrono::duration_cast<Dur>(std::chrono::nanoseconds{
            ev.getProfilingInfo<To>() - ev.getProfilingInfo<From>() });
    }
}
}