org.sapia.ubik.rmi.server.perf
Class Topic

java.lang.Object
  extended by org.sapia.ubik.rmi.server.perf.Topic
All Implemented Interfaces:
java.lang.Comparable

public class Topic
extends java.lang.Object
implements java.lang.Comparable

An instance of this class is used to calculate the duration of an arbitrary operation. Durations are averaged over time.

Usage:

  for(int i = 0; i < 1000;`i++){
    Topic t = ....
    t.start();
    // do something
    t.end();
  }
  System.out.println(t.duration());
 

Author:
Yanick Duchesne
See Also:
PerfAnalyzer

Constructor Summary
Topic(java.lang.String name)
          Constructor for Topic.
 
Method Summary
 int compareTo(java.lang.Object other)
           
 double duration()
           
 void end()
          Calculates the current duration corresponding to this instance, based on its internal start time and system time.
 java.lang.String getName()
           
 boolean isEnabled()
           
 void setEnabled(boolean enabled)
           
 void start()
          Internally sets the start time of this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Topic

public Topic(java.lang.String name)
Constructor for Topic.

Method Detail

getName

public java.lang.String getName()
Returns:
the name of this instance.

start

public void start()
Internally sets the start time of this instance.


end

public void end()
Calculates the current duration corresponding to this instance, based on its internal start time and system time.

See Also:
start()

duration

public double duration()
Returns:
the computed average duration corresponding to this instance.

setEnabled

public void setEnabled(boolean enabled)
Parameters:
enabled - if true, turns this instance's sampling mode to "on".

isEnabled

public boolean isEnabled()
Returns:
true if stat calculation is performed by this instance.

compareTo

public int compareTo(java.lang.Object other)
Specified by:
compareTo in interface java.lang.Comparable
See Also:
Comparable.compareTo(Object)


Copyright © 2010 Sapia OSS. All Rights Reserved.