Package com.aparapi.internal.kernel
Class KernelDeviceProfile
java.lang.Object
com.aparapi.internal.kernel.KernelDeviceProfile
Created by Barney on 02/09/2015.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
private class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
<Thread, KernelDeviceProfile.Accumulator> private final Device
private final DecimalFormat
private final KernelDeviceProfile.GlobalAccumulator
private final AtomicLong
private final AtomicReference
<KernelDeviceProfile.Accumulator> private static Logger
private static final double
private static final int
private final KernelProfile
private static final int
private static final int
private static final int
private static String
-
Constructor Summary
ConstructorsConstructorDescriptionKernelDeviceProfile
(KernelProfile parentProfile, Class<? extends Kernel> kernel, Device device) -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
appendCell
(StringBuilder builder, String cell) private static void
appendRowHeaders
(StringBuilder builder, String device, String count) private KernelDeviceProfile.Accumulator
private KernelDeviceProfile.Accumulator
double
Elapsed time of entire execution, summed over all executions, for the current thread, if it has executed the kernel on the device assigned to this KernelDeviceProfile instance.double
Elapsed time of entire execution, summed over all executions, for all the threads, that executed the kernel on this device.double
Elapsed time for a single event only, i.e.double
Elapsed time for a single event only, i.e.double
getElapsedTimeCurrentThread
(int stage) Elapsed time for a single event only and for the current thread, i.e.double
getElapsedTimeCurrentThread
(int from, int to) Elapsed time for all eventsfrom
throughto
for the current thread.double
getElapsedTimeLastThread
(int stage) Elapsed time for a single event only and for the last thread that finished executing a kernel, i.e.double
getElapsedTimeLastThread
(int from, int to) Elapsed time for all eventsfrom
throughto
for the last thread that executed this KernelDeviceProfile instance respective kernel and device.Retrieves the most recent complete report available for the current thread calling this method.
Note1: If the profile report is intended to be kept in memory, the object should be cloned withProfileReport.clone()
Note2: If the thread didn't execute this KernelDeviceProfile instance respective kernel and device, it will return null.Retrieves the most recent complete report available for the last thread that executed this KernelDeviceProfile instance respective kernel and device.
Note1: If the profile report is intended to be kept in memory, the object should be cloned withProfileReport.clone()
static String
private String
internalCumulativeAsTableRow
(boolean mean) void
onEvent
(ProfilingEvent event) toString()
private ProfileReport
updateProfileReport
(ProfileReport report, long invocationCount, long[] currentTimes)
-
Field Details
-
logger
-
NUM_EVENTS
private static final int NUM_EVENTS -
MILLION
private static final double MILLION- See Also:
-
TABLE_COLUMN_HEADER_WIDTH
private static final int TABLE_COLUMN_HEADER_WIDTH- See Also:
-
TABLE_COLUMN_COUNT_WIDTH
private static final int TABLE_COLUMN_COUNT_WIDTH- See Also:
-
TABLE_COLUMN_WIDTH
private static final int TABLE_COLUMN_WIDTH -
tableHeader
-
parentKernelProfile
-
kernel
-
device
-
format
-
invocationCountGlobal
-
lastAccumulator
-
globalAcc
-
accs
-
-
Constructor Details
-
KernelDeviceProfile
public KernelDeviceProfile(KernelProfile parentProfile, Class<? extends Kernel> kernel, Device device)
-
-
Method Details
-
getAccForThreadPutIfAbsent
-
getAccForThread
-
onEvent
-
updateProfileReport
private ProfileReport updateProfileReport(ProfileReport report, long invocationCount, long[] currentTimes) -
getElapsedTimeCurrentThread
public double getElapsedTimeCurrentThread(int stage) Elapsed time for a single event only and for the current thread, i.e. since the previous stage rather than from the start. -
getElapsedTimeCurrentThread
public double getElapsedTimeCurrentThread(int from, int to) Elapsed time for all eventsfrom
throughto
for the current thread. -
getReportCurrentThread
Retrieves the most recent complete report available for the current thread calling this method.
Note1: If the profile report is intended to be kept in memory, the object should be cloned withProfileReport.clone()
Note2: If the thread didn't execute this KernelDeviceProfile instance respective kernel and device, it will return null.- Returns:
- the profiling report for the current most recent execution
- null, if no profiling report is available for such thread
-
getReportLastThread
Retrieves the most recent complete report available for the last thread that executed this KernelDeviceProfile instance respective kernel and device.
Note1: If the profile report is intended to be kept in memory, the object should be cloned withProfileReport.clone()
- Returns:
- the profiling report for the current most recent execution
- null, if no profiling report is available yet
-
getCumulativeElapsedTimeCurrrentThread
Elapsed time for a single event only, i.e. since the previous stage rather than from the start, summed over all executions, for the current thread, if it has executed the kernel on the device assigned to this KernelDeviceProfile instance.- Parameters:
stage
- the event stage
-
getCumulativeElapsedTimeAllCurrentThread
public double getCumulativeElapsedTimeAllCurrentThread()Elapsed time of entire execution, summed over all executions, for the current thread, if it has executed the kernel on the device assigned to this KernelDeviceProfile instance. -
getElapsedTimeLastThread
public double getElapsedTimeLastThread(int stage) Elapsed time for a single event only and for the last thread that finished executing a kernel, i.e. single event only - since the previous stage rather than from the start.- Parameters:
stage
- the event stage
-
getElapsedTimeLastThread
public double getElapsedTimeLastThread(int from, int to) Elapsed time for all eventsfrom
throughto
for the last thread that executed this KernelDeviceProfile instance respective kernel and device.- Parameters:
from
- the first event to consider that defines the elapsed period startto
- the last event to consider for elapsed period
-
getCumulativeElapsedTimeGlobal
Elapsed time for a single event only, i.e. since the previous stage rather than from the start, summed over all executions, for the last thread that executed this KernelDeviceProfile instance respective kernel and device.- Parameters:
stage
- the event stage
-
getCumulativeElapsedTimeAllGlobal
public double getCumulativeElapsedTimeAllGlobal()Elapsed time of entire execution, summed over all executions, for all the threads, that executed the kernel on this device. -
getTableHeader
-
getLastAsTableRow
-
getCumulativeAsTableRow
-
getAverageAsTableRow
-
internalCumulativeAsTableRow
-
appendRowHeaders
-
appendCell
-
toString
-