org.apache.hadoop.mapreduce
Class Counter

java.lang.Object
  extended by org.apache.hadoop.mapreduce.Counter
All Implemented Interfaces:
Writable
Direct Known Subclasses:
Counters.Counter

public class Counter
extends Object
implements Writable

A named counter that tracks the progress of a map/reduce job.

Counters represent global counters, defined either by the Map-Reduce framework or applications. Each Counter is named by an Enum and has a long for the value.

Counters are bunched into Groups, each comprising of counters from a particular Enum class.


Constructor Summary
protected Counter()
           
protected Counter(String name, String displayName)
           
 
Method Summary
 boolean equals(Object genericRight)
           
 String getDisplayName()
          Get the name of the counter.
 String getName()
           
 long getValue()
          What is the current value of this counter?
 int hashCode()
           
 void increment(long incr)
          Increment this counter by the given value
 void readFields(DataInput in)
          Read the binary representation of the counter
protected  void setDisplayName(String displayName)
          Deprecated. 
 void setValue(long value)
          Set this counter by the given value
 void write(DataOutput out)
          Write the binary representation of the counter
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Counter

protected Counter()

Counter

protected Counter(String name,
                  String displayName)
Method Detail

setDisplayName

@Deprecated
protected void setDisplayName(String displayName)
Deprecated. 


readFields

public void readFields(DataInput in)
                throws IOException
Read the binary representation of the counter

Specified by:
readFields in interface Writable
Parameters:
in - DataInput to deseriablize this object from.
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Write the binary representation of the counter

Specified by:
write in interface Writable
Parameters:
out - DataOuput to serialize this object into.
Throws:
IOException

getName

public String getName()

getDisplayName

public String getDisplayName()
Get the name of the counter.

Returns:
the user facing name of the counter

getValue

public long getValue()
What is the current value of this counter?

Returns:
the current value

setValue

public void setValue(long value)
Set this counter by the given value

Parameters:
value - the value to set

increment

public void increment(long incr)
Increment this counter by the given value

Parameters:
incr - the value to increase this counter by

equals

public boolean equals(Object genericRight)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2009 The Apache Software Foundation