org.objectweb.proactive.benchmarks.timit.util
Class TimerCounter

java.lang.Object
  extended by org.objectweb.proactive.benchmarks.timit.util.TimerCounter
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
MigratableCounter

public class TimerCounter
extends java.lang.Object
implements java.io.Serializable

Represent a counter used for timing procedures

Author:
Brian Amedro, Vladimir Bodnartchouk
See Also:
Serialized Form

Constructor Summary
TimerCounter(java.lang.String s)
          Create a counter with his name as it will be shown on output charts.
 
Method Summary
 void addValue(int t)
          Add a specific time value (in milliseconds) to the counter.
 int getElapsedTime()
           
 int getHierarchicalTime()
           
 int getId()
          Get the counter id
 java.lang.String getName()
          Get the counter name
 int getTotalTime()
           
 boolean isMigratable()
          Used by the Timer to know if a counter can be migrated
 boolean isStarted()
          Keep in mind that this method take a "little bit of time".
 void reset()
          Reset the counter
 void setId(int n)
          Set the counter id
 void setName(java.lang.String s)
          Set the counter name
 void setTimer(HierarchicalTimer timer)
          Used by the Timer to register the counter
 void setValue(int t)
          Set a specific time value (in milliseconds) to the counter.
 void start()
          Start the counter.
 void stop()
          Stop the counter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimerCounter

public TimerCounter(java.lang.String s)
Create a counter with his name as it will be shown on output charts. The counter is disabled by default.

Parameters:
s -
Method Detail

setId

public void setId(int n)
Set the counter id

Parameters:
n -

setName

public void setName(java.lang.String s)
Set the counter name

Parameters:
s -

getId

public int getId()
Get the counter id

Returns:
counter id

getName

public java.lang.String getName()
Get the counter name

Returns:
counter name

setTimer

public void setTimer(HierarchicalTimer timer)
Used by the Timer to register the counter

Parameters:
timer -

isMigratable

public boolean isMigratable()
Used by the Timer to know if a counter can be migrated


start

public void start()
Start the counter.
Note that an IllegalStateException can occur if the counter has been started two times.


stop

public void stop()
Stop the counter.
Note that an IllegalStateException can occur if you stop the counter without starting it.


setValue

public void setValue(int t)
Set a specific time value (in milliseconds) to the counter.
Counter's parents will be modified to keep integrity

Parameters:
t - time value to set in millis

addValue

public void addValue(int t)
Add a specific time value (in milliseconds) to the counter.
Counter's parents will be modified to keep integrity

Parameters:
t - time value to add in millis

isStarted

public boolean isStarted()
Keep in mind that this method take a "little bit of time".
Theorically, you don't need to use this method.

Returns:
true if counter is started, false otherwise

getElapsedTime

public int getElapsedTime()
Returns:
the elapsed time since the last start

getHierarchicalTime

public int getHierarchicalTime()
Returns:
the time value in the current hierarchy

getTotalTime

public int getTotalTime()
Returns:
the total time value (sum of all usage of this counter in all hierarchies)

reset

public void reset()
Reset the counter



Copyright 2001-2007 INRIA All Rights Reserved.