org.apache.hadoop.mapreduce
Class CounterGroup

java.lang.Object
  extended by org.apache.hadoop.mapreduce.CounterGroup
All Implemented Interfaces:
Iterable<Counter>, org.apache.hadoop.io.Writable

@InterfaceAudience.Public
@InterfaceStability.Stable
public class CounterGroup
extends Object
implements org.apache.hadoop.io.Writable, Iterable<Counter>

A group of Counters that logically belong together. Typically, it is an Enum subclass and the counters are the values.


Constructor Summary
protected CounterGroup(String name)
           
  CounterGroup(String name, String displayName)
          Create a CounterGroup.
 
Method Summary
 void addCounter(Counter counter)
          Add a counter to this group.
 boolean equals(Object genericRight)
           
 Counter findCounter(String counterName)
           
 Counter findCounter(String counterName, String displayName)
          Find a counter in a group.
 String getDisplayName()
          Get the display name of the group.
 String getName()
          Get the internal name of the group
 int hashCode()
           
 void incrAllCounters(CounterGroup rightGroup)
           
 Iterator<Counter> iterator()
           
 void readFields(DataInput in)
           
 int size()
          Returns the number of counters in this group.
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CounterGroup

protected CounterGroup(String name)

CounterGroup

public CounterGroup(String name,
                    String displayName)
Create a CounterGroup.

Parameters:
name - the name of the group's enum.
displayName - a name to be displayed for the group.
Method Detail

getName

public String getName()
Get the internal name of the group

Returns:
the internal name

getDisplayName

public String getDisplayName()
Get the display name of the group.

Returns:
the human readable name

addCounter

public void addCounter(Counter counter)
Add a counter to this group.


findCounter

public Counter findCounter(String counterName,
                           String displayName)
Find a counter in a group.

Parameters:
counterName - the name of the counter
displayName - the display name of the counter
Returns:
the counter that was found or added

findCounter

public Counter findCounter(String counterName)

iterator

public Iterator<Counter> iterator()
Specified by:
iterator in interface Iterable<Counter>

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

size

public int size()
Returns the number of counters in this group.


equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

incrAllCounters

public void incrAllCounters(CounterGroup rightGroup)


Copyright © 2009 The Apache Software Foundation