-- GENERATED by C->Haskell Compiler, version 0.16.0 Crystal Seed, 24 Jan 2009 (Haskell)-- Edit the ORIGNAL .chs file instead!{-# LINE 1 "src/System/GPU/OpenCL/Event.chs" #-}{- Copyright (c) 2011 Luis Cabellos,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-}{-# LANGUAGE ForeignFunctionInterface, ScopedTypeVariables, CPP #-}moduleSystem.GPU.OpenCL.Event(-- * TypesCLEvent,CLCommandType(..),CLProfilingInfo(..),CLCommandExecutionStatus(..),-- * FunctionsclWaitForEvents,clRetainEvent,clReleaseEvent,clGetEventCommandQueue,clGetEventCommandType,clGetEventReferenceCount,clGetEventCommandExecutionStatus,clGetEventProfilingInfo)where-- -----------------------------------------------------------------------------importForeignimportForeign.C.TypesimportSystem.GPU.OpenCL.Types(CLEvent,CLint,CLuint,CLulong,CLEventInfo_,CLProfilingInfo_,CLCommandQueue,CLCommandType(..),CLCommandType_,CLCommandExecutionStatus(..),CLProfilingInfo(..),getCommandExecutionStatus,getCLValue,getEnumCL,wrapCheckSuccess,wrapGetInfo)-- -----------------------------------------------------------------------------foreignimportCALLCONV"clWaitForEvents"raw_clWaitForEvents::CLuint->PtrCLEvent->IOCLintforeignimportCALLCONV"clGetEventInfo"raw_clGetEventInfo::CLEvent->CLEventInfo_->CSize->Ptr()->PtrCSize->IOCLintforeignimportCALLCONV"clRetainEvent"raw_clRetainEvent::CLEvent->IOCLintforeignimportCALLCONV"clReleaseEvent"raw_clReleaseEvent::CLEvent->IOCLintforeignimportCALLCONV"clGetEventProfilingInfo"raw_clGetEventProfilingInfo::CLEvent->CLProfilingInfo_->CSize->Ptr()->PtrCSize->IOCLint-- ------------------------------------------------------------------------------- | Waits on the host thread for commands identified by event objects in -- event_list to complete. A command is considered complete if its execution -- status is 'CL_COMPLETE' or a negative value.-- Returns 'True' if the function was executed successfully. It returns 'False'-- if the list of events is empty, or if events specified in event_list do not -- belong to the same context, or if event objects specified in event_list are -- not valid event objects.clWaitForEvents::[CLEvent]->IOBoolclWaitForEvents[]=returnFalseclWaitForEventsxs=allocaArraynevents$\pevents->dopokeArraypeventsxswrapCheckSuccess$raw_clWaitForEvents(fromIntegralnevents)peventswherenevents=lengthxs-- | Increments the event reference count.-- The OpenCL commands that return an event perform an implicit retain.-- Returns 'True' if the function is executed successfully. It returns 'False' -- if event is not a valid event object.clRetainEvent::CLEvent->IOBoolclRetainEventev=wrapCheckSuccess$raw_clRetainEventev-- | Decrements the event reference count.-- Decrements the event reference count. The event object is deleted once the -- reference count becomes zero, the specific command identified by this event -- has completed (or terminated) and there are no commands in the command-queues -- of a context that require a wait for this event to complete.-- Returns 'True' if the function is executed successfully. It returns 'False' -- if event is not a valid event object.clReleaseEvent::CLEvent->IOBoolclReleaseEventev=wrapCheckSuccess$raw_clReleaseEventevdataCLEventInfo=CL_EVENT_COMMAND_QUEUE|CL_EVENT_COMMAND_TYPE|CL_EVENT_COMMAND_EXECUTION_STATUS|CL_EVENT_REFERENCE_COUNTinstanceEnumCLEventInfowherefromEnumCL_EVENT_COMMAND_QUEUE=4560fromEnumCL_EVENT_COMMAND_TYPE=4561fromEnumCL_EVENT_COMMAND_EXECUTION_STATUS=4563fromEnumCL_EVENT_REFERENCE_COUNT=4562toEnum4560=CL_EVENT_COMMAND_QUEUEtoEnum4561=CL_EVENT_COMMAND_TYPEtoEnum4563=CL_EVENT_COMMAND_EXECUTION_STATUStoEnum4562=CL_EVENT_REFERENCE_COUNTtoEnumunmatched=error("CLEventInfo.toEnum: Cannot match "++showunmatched){-# LINE 106 "src/System/GPU/OpenCL/Event.chs" #-}-- | Return the command-queue associated with event.---- This function execute OpenCL clGetEventInfo with 'CL_EVENT_COMMAND_QUEUE'.clGetEventCommandQueue::CLEvent->IOCLCommandQueueclGetEventCommandQueueev=wrapGetInfo(\(dat::PtrCLCommandQueue)->raw_clGetEventInfoevinfoidsize(castPtrdat))idwhereinfoid=getCLValueCL_EVENT_COMMAND_QUEUEsize=fromIntegral$sizeOf(nullPtr::CLCommandQueue)-- | Return the command associated with event.---- This function execute OpenCL clGetEventInfo with 'CL_EVENT_COMMAND_TYPE'.clGetEventCommandType::CLEvent->IOCLCommandTypeclGetEventCommandTypeev=wrapGetInfo(\(dat::PtrCLCommandType_)->raw_clGetEventInfoevinfoidsize(castPtrdat))getEnumCLwhereinfoid=getCLValueCL_EVENT_COMMAND_TYPEsize=fromIntegral$sizeOf(0::CLCommandType_)-- | Return the event reference count. The reference count returned should be -- considered immediately stale. It is unsuitable for general use in applications. -- This feature is provided for identifying memory leaks.---- This function execute OpenCL clGetEventInfo with 'CL_EVENT_REFERENCE_COUNT'.clGetEventReferenceCount::CLEvent->IOCLintclGetEventReferenceCountev=wrapGetInfo(\(dat::PtrCLint)->raw_clGetEventInfoevinfoidsize(castPtrdat))idwhereinfoid=getCLValueCL_EVENT_REFERENCE_COUNTsize=fromIntegral$sizeOf(0::CLint)-- | Return the execution status of the command identified by event.---- This function execute OpenCL clGetEventInfo with-- 'CL_EVENT_COMMAND_EXECUTION_STATUS'.clGetEventCommandExecutionStatus::CLEvent->IOCLCommandExecutionStatusclGetEventCommandExecutionStatusev=wrapGetInfo(\(dat::PtrCLint)->raw_clGetEventInfoevinfoidsize(castPtrdat))getCommandExecutionStatuswhereinfoid=getCLValueCL_EVENT_COMMAND_EXECUTION_STATUSsize=fromIntegral$sizeOf(0::CLint){-| Returns profiling information for the command associated with event if
profiling is enabled. The unsigned 64-bit values returned can be used to measure
the time in nano-seconds consumed by OpenCL commands.
OpenCL devices are required to correctly track time across changes in device
frequency and power states. The 'CL_DEVICE_PROFILING_TIMER_RESOLUTION' specifies
the resolution of the timer i.e. the number of nanoseconds elapsed before the
timer is incremented.
Event objects can be used to capture profiling information that measure
execution time of a command. Profiling of OpenCL commands can be enabled either
by using a command-queue created with 'CL_QUEUE_PROFILING_ENABLE' flag set in
properties argument to clCreateCommandQueue or by setting the
'CL_QUEUE_PROFILING_ENABLE' flag in properties argument to
'clSetCommandQueueProperty'.
'clGetEventProfilingInfo' returns the valueif the function is executed
successfully and the profiling information has been recorded, and returns
'Nothing' if the 'CL_QUEUE_PROFILING_ENABLE' flag is not set for the
command-queue and if the profiling information is currently not available
(because the command identified by event has not completed), or if event is a
not a valid event object.
-}clGetEventProfilingInfo::CLEvent->CLProfilingInfo->IOCLulongclGetEventProfilingInfoevprof=wrapGetInfo(\(dat::PtrCLulong)->raw_clGetEventProfilingInfoevinfoidsize(castPtrdat))idwhereinfoid=getCLValueprofsize=fromIntegral$sizeOf(0::CLulong)-- -----------------------------------------------------------------------------