org.apache.excalibur.instrument
Class CounterInstrument

java.lang.Object
  extended byorg.apache.excalibur.instrument.AbstractInstrument
      extended byorg.apache.excalibur.instrument.CounterInstrument
All Implemented Interfaces:
Instrument

public class CounterInstrument
extends AbstractInstrument

CounterInstruments can be used to profile the number of times that something happens. They are perfect for profiling things like the number of times a class instance is created or destroyed. Or the number of times that a method is accessed.

Since:
4.1
Version:
CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:28 $
Author:
Avalon Development Team

Constructor Summary
CounterInstrument(java.lang.String name)
          Creates a new CounterInstrument.
 
Method Summary
 void increment()
          Increments the Instrument.
 void increment(int count)
          Increments the Instrument by a specified count.
 
Methods inherited from class org.apache.excalibur.instrument.AbstractInstrument
getInstrumentName, getInstrumentProxy, isActive, setInstrumentProxy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CounterInstrument

public CounterInstrument(java.lang.String name)
Creates a new CounterInstrument.

Parameters:
name - The name of the Instrument. The value should be a string which does not contain spaces or periods.
Method Detail

increment

public void increment()
Increments the Instrument. This method is optimized to be extremely light weight when an InstrumentManager is not present and there are no registered CounterInstrumentListeners.


increment

public void increment(int count)
Increments the Instrument by a specified count. This method is optimized to be extremely light weight when an InstrumentManager is not present and there are no registered CounterInstrumentListeners.

Parameters:
count - A positive integer to increment the counter by.
Throws:
java.lang.IllegalArgumentException - If the count is not positive.


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.