org.apache.hadoop.mapreduce.counters
Class GenericCounter

java.lang.Object
  extended by org.apache.hadoop.mapreduce.counters.AbstractCounter
      extended by org.apache.hadoop.mapreduce.counters.GenericCounter
All Implemented Interfaces:
org.apache.hadoop.io.Writable, Counter

@InterfaceAudience.Private
public class GenericCounter
extends AbstractCounter

A generic counter implementation


Constructor Summary
GenericCounter()
           
GenericCounter(String name, String displayName)
           
GenericCounter(String name, String displayName, long value)
           
 
Method Summary
 String getDisplayName()
          Get the display name of the counter.
 String getName()
           
 Counter getUnderlyingCounter()
           
 long getValue()
          What is the current value of this counter?
 void increment(long incr)
          Increment this counter by the given value
 void readFields(DataInput in)
           
 void setDisplayName(String displayName)
          Deprecated. 
 void setValue(long value)
          Set this counter by the given value
 void write(DataOutput out)
          GenericCounter ::= keyName isDistinctDisplayName [displayName] value
 
Methods inherited from class org.apache.hadoop.mapreduce.counters.AbstractCounter
equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericCounter

public GenericCounter()

GenericCounter

public GenericCounter(String name,
                      String displayName)

GenericCounter

public GenericCounter(String name,
                      String displayName,
                      long value)
Method Detail

setDisplayName

@Deprecated
public void setDisplayName(String displayName)
Deprecated. 

Description copied from interface: Counter
Set the display name of the counter

Specified by:
setDisplayName in interface Counter
Overrides:
setDisplayName in class AbstractCounter
Parameters:
displayName - of the counter

readFields

public void readFields(DataInput in)
                throws IOException
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
GenericCounter ::= keyName isDistinctDisplayName [displayName] value

Throws:
IOException

getName

public String getName()
Returns:
the name of the counter

getDisplayName

public String getDisplayName()
Description copied from interface: Counter
Get the display name of the counter.

Returns:
the user facing name of the counter

getValue

public long getValue()
Description copied from interface: Counter
What is the current value of this counter?

Returns:
the current value

setValue

public void setValue(long value)
Description copied from interface: Counter
Set this counter by the given value

Parameters:
value - the value to set

increment

public void increment(long incr)
Description copied from interface: Counter
Increment this counter by the given value

Parameters:
incr - the value to increase this counter by

getUnderlyingCounter

public Counter getUnderlyingCounter()


Copyright © 2012 Apache Software Foundation. All Rights Reserved.