public class KernelDeviceProfile
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private class |
KernelDeviceProfile.Accumulator |
private class |
KernelDeviceProfile.GlobalAccumulator |
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.Thread,KernelDeviceProfile.Accumulator> |
accs |
private Device |
device |
private java.text.DecimalFormat |
format |
private KernelDeviceProfile.GlobalAccumulator |
globalAcc |
private java.util.concurrent.atomic.AtomicLong |
invocationCountGlobal |
private java.lang.Class<? extends Kernel> |
kernel |
private java.util.concurrent.atomic.AtomicReference<KernelDeviceProfile.Accumulator> |
lastAccumulator |
private static java.util.logging.Logger |
logger |
private static double |
MILLION |
private static int |
NUM_EVENTS |
private KernelProfile |
parentKernelProfile |
private static int |
TABLE_COLUMN_COUNT_WIDTH |
private static int |
TABLE_COLUMN_HEADER_WIDTH |
private static int |
TABLE_COLUMN_WIDTH |
private static java.lang.String |
tableHeader |
Constructor and Description |
---|
KernelDeviceProfile(KernelProfile parentProfile,
java.lang.Class<? extends Kernel> kernel,
Device device) |
Modifier and Type | Method and Description |
---|---|
private static void |
appendCell(java.lang.StringBuilder builder,
java.lang.String cell) |
private static void |
appendRowHeaders(java.lang.StringBuilder builder,
java.lang.String device,
java.lang.String count) |
private KernelDeviceProfile.Accumulator |
getAccForThread() |
private KernelDeviceProfile.Accumulator |
getAccForThreadPutIfAbsent() |
java.lang.String |
getAverageAsTableRow() |
java.lang.String |
getCumulativeAsTableRow() |
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.
|
double |
getCumulativeElapsedTimeAllGlobal()
Elapsed time of entire execution, summed over all executions, for all the threads,
that executed the kernel on this device.
|
double |
getCumulativeElapsedTimeCurrrentThread(ProfilingEvent stage)
Elapsed time for a single event only, i.e.
|
double |
getCumulativeElapsedTimeGlobal(ProfilingEvent stage)
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 events
from through to 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 events
from through to for the last thread that executed this KernelDeviceProfile
instance respective kernel and device. |
java.lang.String |
getLastAsTableRow() |
java.lang.ref.WeakReference<ProfileReport> |
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 with ProfileReport.clone() Note2: If the thread didn't execute this KernelDeviceProfile instance respective kernel and device, it will return null. |
java.lang.ref.WeakReference<ProfileReport> |
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 with ProfileReport.clone() |
static java.lang.String |
getTableHeader() |
private java.lang.String |
internalCumulativeAsTableRow(boolean mean) |
void |
onEvent(ProfilingEvent event) |
java.lang.String |
toString() |
private ProfileReport |
updateProfileReport(ProfileReport report,
long invocationCount,
long[] currentTimes) |
private static java.util.logging.Logger logger
private static final int NUM_EVENTS
private static final double MILLION
private static final int TABLE_COLUMN_HEADER_WIDTH
private static final int TABLE_COLUMN_COUNT_WIDTH
private static final int TABLE_COLUMN_WIDTH
private static java.lang.String tableHeader
private final KernelProfile parentKernelProfile
private final java.lang.Class<? extends Kernel> kernel
private final Device device
private final java.text.DecimalFormat format
private final java.util.concurrent.atomic.AtomicLong invocationCountGlobal
private final java.util.concurrent.atomic.AtomicReference<KernelDeviceProfile.Accumulator> lastAccumulator
private final KernelDeviceProfile.GlobalAccumulator globalAcc
private final java.util.Map<java.lang.Thread,KernelDeviceProfile.Accumulator> accs
public KernelDeviceProfile(KernelProfile parentProfile, java.lang.Class<? extends Kernel> kernel, Device device)
private KernelDeviceProfile.Accumulator getAccForThreadPutIfAbsent()
private KernelDeviceProfile.Accumulator getAccForThread()
public void onEvent(ProfilingEvent event)
private ProfileReport updateProfileReport(ProfileReport report, long invocationCount, long[] currentTimes)
public double getElapsedTimeCurrentThread(int stage)
public double getElapsedTimeCurrentThread(int from, int to)
from
through to
for the current thread.public java.lang.ref.WeakReference<ProfileReport> getReportCurrentThread()
ProfileReport.clone()
public java.lang.ref.WeakReference<ProfileReport> getReportLastThread()
ProfileReport.clone()
public double getCumulativeElapsedTimeCurrrentThread(ProfilingEvent stage)
stage
- the event stagepublic double getCumulativeElapsedTimeAllCurrentThread()
public double getElapsedTimeLastThread(int stage)
stage
- the event stagepublic double getElapsedTimeLastThread(int from, int to)
from
through to
for the last thread that executed this KernelDeviceProfile
instance respective kernel and device.from
- the first event to consider that defines the elapsed period startto
- the last event to consider for elapsed periodpublic double getCumulativeElapsedTimeGlobal(ProfilingEvent stage)
stage
- the event stagepublic double getCumulativeElapsedTimeAllGlobal()
public static java.lang.String getTableHeader()
public java.lang.String getLastAsTableRow()
public java.lang.String getCumulativeAsTableRow()
public java.lang.String getAverageAsTableRow()
private java.lang.String internalCumulativeAsTableRow(boolean mean)
private static void appendRowHeaders(java.lang.StringBuilder builder, java.lang.String device, java.lang.String count)
private static void appendCell(java.lang.StringBuilder builder, java.lang.String cell)
public java.lang.String toString()
toString
in class java.lang.Object