org.jikesrvm.mm.mmtk
Class SynchronizedCounter

java.lang.Object
  extended by org.mmtk.vm.SynchronizedCounter
      extended by org.jikesrvm.mm.mmtk.SynchronizedCounter

public final class SynchronizedCounter
extends SynchronizedCounter

A counter that supports atomic increment and reset.


Field Summary
private  int count
           
private static Offset offset
           
 
Constructor Summary
SynchronizedCounter()
           
 
Method Summary
static void boot()
           
 int increment()
          Adds 1 to the counter.
 int peek()
          Peek at the counter
 int reset()
          Reset the counter to 0, returning its previous value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

offset

private static Offset offset

count

private int count
Constructor Detail

SynchronizedCounter

public SynchronizedCounter()
Method Detail

boot

public static void boot()

reset

public int reset()
Description copied from class: SynchronizedCounter
Reset the counter to 0, returning its previous value.

Specified by:
reset in class SynchronizedCounter
Returns:
The value of the counter, prior to reset.

increment

public int increment()
Description copied from class: SynchronizedCounter
Adds 1 to the counter.

Specified by:
increment in class SynchronizedCounter
Returns:
the value before the add

peek

public int peek()
Description copied from class: SynchronizedCounter
Peek at the counter

Specified by:
peek in class SynchronizedCounter
Returns:
The current value of the counter.