com.sun.sgs.impl.profile
Class ProfileReportImpl

java.lang.Object
  extended by com.sun.sgs.impl.profile.ProfileReportImpl
All Implemented Interfaces:
ProfileReport

 class ProfileReportImpl
extends Object
implements ProfileReport

Package-private implementation of ProfileReport.


Field Summary
(package private)  long actualStartTime
           
(package private)  Identity owner
           
(package private)  int readyCount
           
(package private)  long runningTime
           
(package private)  long scheduledStartTime
           
(package private)  boolean succeeded
           
(package private)  KernelRunnable task
           
(package private)  Throwable throwable
           
(package private)  byte[] transactionId
           
(package private)  int tryCount
           
 
Constructor Summary
ProfileReportImpl(KernelRunnable task, Identity owner, long scheduledStartTime, int readyCount)
          Creates an instance of ProfileReportImpl with the actual starting time being set to the current time.
 
Method Summary
(package private)  void addListener(TransactionListenerDetail listenerDetail)
           
(package private)  void addOperation(String operationName)
          Package-private method used to add an operation.
(package private)  void addParticipant(ProfileParticipantDetail participantDetail)
           
(package private)  void addTaskSample(String sampleName, long value)
          Package-private method used to add to a task-local sample.
(package private)  void finish()
          Package-private method to note that a task has finished running.
 AccessedObjectsDetail getAccessedObjectsDetail()
          Returns detail of the object accesses as reported by the AccessCoordinator or null if no objects were accessed, no accesses reported, or if this report is for a non-transactional task.
 long getActualStartTime()
          Returns the time at which the task actually started running.
 Throwable getFailureCause()
          Returns any failure that occurred during the execution of this report's task, or null if no failure occurred.
 Set<TransactionListenerDetail> getListenerDetails()
          Returns detail about each listener for the transaction, or an empty Set if the task was not transactional or had no listeners.
 Set<ProfileParticipantDetail> getParticipantDetails()
          Returns detail about each participant in the transaction, or an empty Set if the task was not transactional.
 int getReadyCount()
          Returns the number of tasks in the scheduler and ready to run when this report's task was started.
 List<String> getReportedOperations()
          Returns the operations that were reported as executed during the running of the task.
 int getRetryCount()
          Returns the number of times this task has been tried.
 long getRunningTime()
          Returns the length of time spent running the task.
 long getScheduledStartTime()
          Returns the time at which that task was scheduled to run.
 KernelRunnable getTask()
          Returns the run task that generated this report.
 Identity getTaskOwner()
          Returns the owner of the run task.
 byte[] getTransactionId()
          Returns the identifier for the task's transaction, or null if the task was not transactional.
 Map<String,Long> getUpdatedTaskCounters()
          Returns the values of the task-local counters that were updated during the running of the task.
 Map<String,List<Long>> getUpdatedTaskSamples()
          Returns the list of values for the task-local samples that were updated during the running of the task.
(package private)  void incrementTaskCounter(String counter, long value)
          Package-private method used to increment task-local counters that were changed during this task.
(package private)  void merge(ProfileReportImpl report)
          Package-private method used to merge the state of one report into another.
(package private)  void setAccessedObjectsDetail(AccessedObjectsDetail detail)
           
 boolean wasTaskSuccessful()
          Returns whether the task successfully ran to completion.
 boolean wasTaskTransactional()
          Returns whether any of the task was transactional.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

task

final KernelRunnable task

owner

final Identity owner

scheduledStartTime

final long scheduledStartTime

readyCount

final int readyCount

actualStartTime

final long actualStartTime

transactionId

byte[] transactionId

succeeded

boolean succeeded

runningTime

long runningTime

tryCount

int tryCount

throwable

Throwable throwable
Constructor Detail

ProfileReportImpl

ProfileReportImpl(KernelRunnable task,
                  Identity owner,
                  long scheduledStartTime,
                  int readyCount)
Creates an instance of ProfileReportImpl with the actual starting time being set to the current time.

Parameters:
task - the KernelRunnable being reported on
owner - the Identity that owns the task
scheduledStartTime - the time the task was scheduled to run
readyCount - the number of tasks in the scheduler, ready to run, that are associated with the same context as the task
Method Detail

incrementTaskCounter

void incrementTaskCounter(String counter,
                          long value)
Package-private method used to increment task-local counters that were changed during this task. If this counter hasn't had a value reported yet for this task, then the provided value is set as the current value for the counter.

Parameters:
counter - the name of the counter
value - the amount to increment the counter

addTaskSample

void addTaskSample(String sampleName,
                   long value)
Package-private method used to add to a task-local sample. If this sample hasn't had a value reported yet for this task, then a new list is made and the the provided value is added to it.

Parameters:
sampleName - the name of the sample
value - the latest value for the sample

addOperation

void addOperation(String operationName)
Package-private method used to add an operation.

Parameters:
operationName - name of the operation

addParticipant

void addParticipant(ProfileParticipantDetail participantDetail)

addListener

void addListener(TransactionListenerDetail listenerDetail)

setAccessedObjectsDetail

void setAccessedObjectsDetail(AccessedObjectsDetail detail)

getTask

public KernelRunnable getTask()
Returns the run task that generated this report.

Specified by:
getTask in interface ProfileReport
Returns:
the KernelRunnable that was run

getTaskOwner

public Identity getTaskOwner()
Returns the owner of the run task.

Specified by:
getTaskOwner in interface ProfileReport
Returns:
the Identity of the task owner

wasTaskTransactional

public boolean wasTaskTransactional()
Returns whether any of the task was transactional.

Specified by:
wasTaskTransactional in interface ProfileReport
Returns:
true if any part of the task ran transactionally, false otherwise

getTransactionId

public byte[] getTransactionId()
Returns the identifier for the task's transaction, or null if the task was not transactional.

Specified by:
getTransactionId in interface ProfileReport
Returns:
the transaction identifier or null

getParticipantDetails

public Set<ProfileParticipantDetail> getParticipantDetails()
Returns detail about each participant in the transaction, or an empty Set if the task was not transactional.

Specified by:
getParticipantDetails in interface ProfileReport
Returns:
a Set of ProfileParticipantDetail

getListenerDetails

public Set<TransactionListenerDetail> getListenerDetails()
Returns detail about each listener for the transaction, or an empty Set if the task was not transactional or had no listeners.

Specified by:
getListenerDetails in interface ProfileReport
Returns:
a Set of TransactionListenerDetail

wasTaskSuccessful

public boolean wasTaskSuccessful()
Returns whether the task successfully ran to completion. If this task was transactional, then this means that the task committed successfully.

Specified by:
wasTaskSuccessful in interface ProfileReport
Returns:
true if this task completed successfully, false otherwise

getScheduledStartTime

public long getScheduledStartTime()
Returns the time at which that task was scheduled to run.

Specified by:
getScheduledStartTime in interface ProfileReport
Returns:
the requested starting time for the task in milliseconds since January 1, 1970

getActualStartTime

public long getActualStartTime()
Returns the time at which the task actually started running.

Specified by:
getActualStartTime in interface ProfileReport
Returns:
the actual starting time for the task in milliseconds since January 1, 1970

getRunningTime

public long getRunningTime()
Returns the length of time spent running the task. Note that this is wall-clock time, not the time actually spent running on the processor.

Specified by:
getRunningTime in interface ProfileReport
Returns:
the length in milliseconds to execute the task

getRetryCount

public int getRetryCount()
Returns the number of times this task has been tried. If this is the first time the task has been run, then this method returns 1.

Specified by:
getRetryCount in interface ProfileReport
Returns:
the number of times this task has been tried

getReportedOperations

public List<String> getReportedOperations()
Returns the operations that were reported as executed during the running of the task. If no operations were reported, then an empty List is returned.

Specified by:
getReportedOperations in interface ProfileReport
Returns:
a List of Strings of the names of the reported operations, in the order they were reported

getUpdatedTaskCounters

public Map<String,Long> getUpdatedTaskCounters()
Returns the values of the task-local counters that were updated during the running of the task. If no task-local counters were updated, then an empty Map is returned. The Map is a mapping from counter name to counter value.

Specified by:
getUpdatedTaskCounters in interface ProfileReport
Returns:
a Map from counter name to observed value

getUpdatedTaskSamples

public Map<String,List<Long>> getUpdatedTaskSamples()
Returns the list of values for the task-local samples that were updated during the running of the task. If no task-local samples were updated, then an empty Map is returned. The Map is a mapping from sample name to an oldest-first list of sample values.

Specified by:
getUpdatedTaskSamples in interface ProfileReport
Returns:
a Map from sample name to a list of values added during the task

getAccessedObjectsDetail

public AccessedObjectsDetail getAccessedObjectsDetail()
Returns detail of the object accesses as reported by the AccessCoordinator or null if no objects were accessed, no accesses reported, or if this report is for a non-transactional task.

Specified by:
getAccessedObjectsDetail in interface ProfileReport
Returns:
the associated access detail or null

getReadyCount

public int getReadyCount()
Returns the number of tasks in the scheduler and ready to run when this report's task was started.

Specified by:
getReadyCount in interface ProfileReport
Returns:
the number of ready tasks

getFailureCause

public Throwable getFailureCause()
Returns any failure that occurred during the execution of this report's task, or null if no failure occurred. This Throwable will always be null if ProfileReport.wasTaskSuccessful() returns true.

Specified by:
getFailureCause in interface ProfileReport
Returns:
the Throwable thrown during task execution or null if no failure occurred

merge

void merge(ProfileReportImpl report)
Package-private method used to merge the state of one report into another. This is typically used when a nested, profiled task completes and needs to share its data with its parent.


finish

void finish()
Package-private method to note that a task has finished running. All collections are modified to be immutable.


RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved