Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.mapreduce
Class Counters

    java.lang.Object
      org.apache.hadoop.mapreduce.Counters

All Implemented Interfaces:
  Iterable<CounterGroup>, Writable

    public class Counters

extends Object
implements Writable, Iterable<CounterGroup>

Constructor Summary
`Counters()`
`Counters(Counters counters)`

Method Summary
`int` | `countCounters()` Returns the total number of counters, by summing the number of counters in each group.
`boolean` | `equals(Object genericRight)`
`Counter` | `findCounter(Enum<?> key)` Find the counter for the given enum.
`Counter` | `findCounter(String groupName, String counterName)`
`CounterGroup` | `getGroup(String groupName)` Returns the named counter group, or an empty group if there is none with the specified name.
`Collection<String>` | `getGroupNames()` Returns the names of all counter classes.
`int` | `hashCode()`
`void` | `incrAllCounters(Counters other)` Increments multiple counters by their amounts in another Counters instance.
`Iterator<CounterGroup>` | `iterator()`
`void` | `readFields(DataInput in)` Read a set of groups.
`String` | `toString()` Return textual representation of the counter values.
`void` | `write(DataOutput out)` Write the set of groups.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Counters

    public Counters()

### Counters

    public Counters(Counters counters)

Method Detail

### findCounter

    public Counter findCounter(String groupName,
                               String counterName)

### findCounter

    public Counter findCounter(Enum<?> key)

  Find the counter for the given enum. The same enum will always return the same counter.

  Parameters:
    `key` - the counter key
  Returns:
    the matching counter object

### getGroupNames

    public Collection<String> getGroupNames()

  Returns the names of all counter classes.

  Returns:
    Set of counter names.

### iterator

    public Iterator<CounterGroup> iterator()

  Specified by:
    `iterator` in interface `Iterable<CounterGroup>`

### getGroup

    public CounterGroup getGroup(String groupName)

  Returns the named counter group, or an empty group if there is none with the specified name.

### countCounters

    public int countCounters()

  Returns the total number of counters, by summing the number of counters in each group.

### write

    public void write(DataOutput out)
               throws IOException

  Write the set of groups. The external format is: #groups (groupName group)* i.e. the number of groups followed by 0 or more groups, where each group is of the form: groupDisplayName #counters (false | true counter)* where each counter is of the form: name (false | true displayName) value

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

### readFields

    public void readFields(DataInput in)
                    throws IOException

  Read a set of groups.

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

### toString

    public String toString()

  Return textual representation of the counter values.

  Overrides:
    `toString` in class `Object`

### incrAllCounters

    public void incrAllCounters(Counters other)

  Increments multiple counters by their amounts in another Counters instance.

  Parameters:
    `other` - the other Counters instance

### equals

    public boolean equals(Object genericRight)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation