Package org.apache.hadoop.mapred
Class Counters.Group
java.lang.Object
org.apache.hadoop.mapred.Counters.Group
- All Implemented Interfaces:
Iterable<Counters.Counter>,Writable,CounterGroupBase<Counters.Counter>
- Enclosing class:
- Counters
@Public
@Stable
public static class Counters.Group
extends Object
implements CounterGroupBase<Counters.Counter>
Group of counters, comprising of counters from a particular
counter Enum class.
Grouphandles localization of the class name and the
counter names.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddCounter(String name, String displayName, long value) Add a counter to this groupvoidaddCounter(Counters.Counter counter) Add a counter to this group.booleanfindCounter(String counterName) Find a counter in the group.findCounter(String counterName, boolean create) Find a counter in the groupfindCounter(String counterName, String displayName) Find a counter in the group.getCounter(int id, String name) Deprecated.longgetCounter(String counterName) getCounterForName(String name) Get the counter for the given name and create it if it doesn't exist.Get the display name of the group.getName()Get the internal name of the groupinthashCode()voidincrAllCounters(CounterGroupBase<Counters.Counter> rightGroup) Increment all counters by a group of countersiterator()voidreadFields(DataInput in) Deserialize the fields of this object fromin.voidsetDisplayName(String displayName) Set the display name of the groupintsize()voidwrite(DataOutput out) Serialize the fields of this object toout.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Group
protected Group()
-
-
Method Details
-
getCounter
- Parameters:
counterName- the name of the counter- Returns:
- the value of the specified counter, or 0 if the counter does not exist.
-
makeEscapedCompactString
- Returns:
- the compact stringified version of the group in the format {(actual-name)(display-name)(value)[][][]} where [] are compact strings for the counters within.
-
getCounter
Deprecated.usefindCounter(String)insteadGet the counter for the given id and create it if it doesn't exist.- Parameters:
id- the numeric id of the counter within the groupname- the internal counter name- Returns:
- the counter
-
getCounterForName
Get the counter for the given name and create it if it doesn't exist.- Parameters:
name- the internal counter name- Returns:
- the counter
-
write
Description copied from interface:WritableSerialize the fields of this object toout.- Specified by:
writein interfaceWritable- Parameters:
out-DataOuputto serialize this object into.- Throws:
IOException- any other problem for write.
-
readFields
Description copied from interface:WritableDeserialize the fields of this object fromin.For efficiency, implementations should attempt to re-use storage in the existing object where possible.
- Specified by:
readFieldsin interfaceWritable- Parameters:
in-DataInputto deseriablize this object from.- Throws:
IOException- any other problem for readFields.
-
iterator
- Specified by:
iteratorin interfaceIterable<Counters.Counter>
-
getName
Description copied from interface:CounterGroupBaseGet the internal name of the group- Specified by:
getNamein interfaceCounterGroupBase<Counters.Counter>- Returns:
- the internal name
-
getDisplayName
Description copied from interface:CounterGroupBaseGet the display name of the group.- Specified by:
getDisplayNamein interfaceCounterGroupBase<Counters.Counter>- Returns:
- the human readable name
-
setDisplayName
Description copied from interface:CounterGroupBaseSet the display name of the group- Specified by:
setDisplayNamein interfaceCounterGroupBase<Counters.Counter>- Parameters:
displayName- of the group
-
addCounter
Description copied from interface:CounterGroupBaseAdd a counter to this group.- Specified by:
addCounterin interfaceCounterGroupBase<Counters.Counter>- Parameters:
counter- to add
-
addCounter
Description copied from interface:CounterGroupBaseAdd a counter to this group- Specified by:
addCounterin interfaceCounterGroupBase<Counters.Counter>- Parameters:
name- of the counterdisplayName- of the countervalue- of the counter- Returns:
- the counter
-
findCounter
Description copied from interface:CounterGroupBaseFind a counter in the group.- Specified by:
findCounterin interfaceCounterGroupBase<Counters.Counter>- Parameters:
counterName- the name of the counterdisplayName- the display name of the counter- Returns:
- the counter that was found or added
-
findCounter
Description copied from interface:CounterGroupBaseFind a counter in the group- Specified by:
findCounterin interfaceCounterGroupBase<Counters.Counter>- Parameters:
counterName- the name of the countercreate- create the counter if not found if true- Returns:
- the counter that was found or added or null if create is false
-
findCounter
Description copied from interface:CounterGroupBaseFind a counter in the group.- Specified by:
findCounterin interfaceCounterGroupBase<Counters.Counter>- Parameters:
counterName- the name of the counter- Returns:
- the counter that was found or added
-
size
public int size()- Specified by:
sizein interfaceCounterGroupBase<Counters.Counter>- Returns:
- the number of counters in this group.
-
incrAllCounters
Description copied from interface:CounterGroupBaseIncrement all counters by a group of counters- Specified by:
incrAllCountersin interfaceCounterGroupBase<Counters.Counter>- Parameters:
rightGroup- the group to be added to this group
-
getUnderlyingGroup
- Specified by:
getUnderlyingGroupin interfaceCounterGroupBase<Counters.Counter>
-
equals
-
hashCode
public int hashCode()
-
findCounter(String)instead