示例#1
0
func (e *Event) GetEventProfilingInfo(paramName ProfilingInfo) (int64, error) {
	var paramValue C.cl_ulong
	if err := C.clGetEventProfilingInfo(e.clEvent, C.cl_profiling_info(paramName), C.size_t(unsafe.Sizeof(paramValue)), unsafe.Pointer(&paramValue), nil); err != C.CL_SUCCESS {
		return 0, toError(err)
	}
	return int64(paramValue), nil
}
示例#2
0
文件: event.go 项目: Dirbaio/gominer
func CLGetEventProfilingInfo(event CL_event,
	param_name CL_profiling_info,
	param_value_size CL_size_t,
	param_value *interface{},
	param_value_size_ret *CL_size_t) CL_int {

	if (param_value_size == 0 || param_value == nil) && param_value_size_ret == nil {
		return CL_INVALID_VALUE
	} else {
		var c_param_value_size_ret C.size_t
		var c_errcode_ret C.cl_int

		if param_value_size == 0 || param_value == nil {
			c_errcode_ret = C.clGetEventProfilingInfo(event.cl_event,
				C.cl_profiling_info(param_name),
				C.size_t(param_value_size),
				nil,
				&c_param_value_size_ret)
		} else {
			switch param_name {
			case CL_PROFILING_COMMAND_QUEUED,
				CL_PROFILING_COMMAND_SUBMIT,
				CL_PROFILING_COMMAND_START,
				CL_PROFILING_COMMAND_END,
				CL_PROFILING_COMMAND_COMPLETE:

				var value C.cl_ulong
				c_errcode_ret = C.clGetEventProfilingInfo(event.cl_event,
					C.cl_profiling_info(param_name),
					C.size_t(param_value_size),
					unsafe.Pointer(&value),
					&c_param_value_size_ret)

				*param_value = CL_ulong(value)
			default:
				return CL_INVALID_VALUE
			}
		}

		if param_value_size_ret != nil {
			*param_value_size_ret = CL_size_t(c_param_value_size_ret)
		}

		return CL_int(c_errcode_ret)
	}
}
示例#3
0
文件: package.go 项目: mantyr/cl
// see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetEventProfilingInfo.html
func GetEventProfilingInfo(e Event, paramName ProfilingInfo, paramValueSize uint64, paramValue unsafe.Pointer, paramValueSizeRet *uint64) ErrorCode {
	return ErrorCode(C.clGetEventProfilingInfo(e.clEvent, C.cl_profiling_info(paramName), C.size_t(paramValueSize), paramValue, (*C.size_t)(paramValueSizeRet)))
}