SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | Protected Member Functions | Static Package Attributes | List of all members
ThreadCPUTimeChrono Class Reference

Extends the AbstractChrono class to compute the CPU time for a single thread. More...

Inheritance diagram for ThreadCPUTimeChrono:
[legend]
Collaboration diagram for ThreadCPUTimeChrono:
[legend]

Public Member Functions

 ThreadCPUTimeChrono ()
 Constructs a ThreadCPUTimeChrono object associated with current thread and initializes it to zero.
 
 ThreadCPUTimeChrono (Thread inThread)
 Constructs a ThreadCPUTimeChrono object associated with the given Thread variable and initializes it to zero.
 
- Public Member Functions inherited from AbstractChrono
 AbstractChrono ()
 
void init ()
 Initializes this AbstractChrono to zero.
 
double getSeconds ()
 Returns the CPU time in seconds used by the program since the last call to init for this AbstractChrono. More...
 
double getMinutes ()
 Returns the CPU time in minutes used by the program since the last call to init for this AbstractChrono. More...
 
double getHours ()
 Returns the CPU time in hours used by the program since the last call to init for this AbstractChrono. More...
 
String format ()
 Converts the CPU time used by the program since its last call to init for this AbstractChrono to a String in the HH:MM:SS.xx format. More...
 

Protected Member Functions

void getTime (long[] tab)
 
long getTime ()
 
- Protected Member Functions inherited from AbstractChrono
abstract void getTime (long[] tab)
 

Static Package Attributes

static ThreadMXBean threadMXBean = null
 

Additional Inherited Members

- Static Public Member Functions inherited from AbstractChrono
static String format (double time)
 Converts the time time, given in seconds, to a String in the HH:MM:SS.xx format. More...
 

Detailed Description

Extends the AbstractChrono class to compute the CPU time for a single thread.

It is available only under Java 1.5 which provides platform-independent facilities to get the CPU time for a single thread through management API.

Note that this chrono might not work properly on some systems running Linux because of a bug in Sun’s implementation or Linux kernel. For instance, this class unexpectedly computes the global CPU time under Fedora Core 4, kernel 2.6.17 and JRE version 1.5.0-09. With Fedora Core 6, kernel 2.6.20, the function is working properly. As a result, one should not rely on this bug to get the global CPU time.

Note that the above bug does not prevent one from using this chrono to compute the CPU time for a single-threaded application. In that case, the global CPU time corresponds to the CPU time of the current thread.

Running timer fonctions when the associated thread is dead will return 0.


The documentation for this class was generated from the following file: