C
- type of counter inside the countersG
- type of group inside the counters@InterfaceAudience.Public @InterfaceStability.Stable public abstract class AbstractCounters<C extends Counter,G extends CounterGroupBase<C>> extends Object implements Writable, Iterable<G>
Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.logging.Log |
LOG |
Constructor and Description |
---|
AbstractCounters(AbstractCounters<C1,G1> counters,
org.apache.hadoop.mapreduce.counters.CounterGroupFactory<C,G> groupFactory)
Construct from another counters object.
|
AbstractCounters(org.apache.hadoop.mapreduce.counters.CounterGroupFactory<C,G> gf) |
Modifier and Type | Method and Description |
---|---|
int |
countCounters()
Returns the total number of counters, by summing the number of counters
in each group.
|
boolean |
equals(Object genericRight) |
C |
findCounter(Enum<?> key)
Find the counter for the given enum.
|
C |
findCounter(String groupName,
String counterName)
Find a counter, create one if necessary
|
G |
getGroup(String groupName)
Returns the named counter group, or an empty group if there is none
with the specified name.
|
Iterable<String> |
getGroupNames()
Returns the names of all counter classes.
|
int |
hashCode() |
void |
incrAllCounters(AbstractCounters<C,G> other)
Increments multiple counters by their amounts in another Counters
instance.
|
Iterator<G> |
iterator() |
void |
readFields(DataInput in)
Deserialize the fields of this object from
in . |
String |
toString()
Return textual representation of the counter values.
|
void |
write(DataOutput out)
Write the set of groups.
|
@InterfaceAudience.Private public AbstractCounters(org.apache.hadoop.mapreduce.counters.CounterGroupFactory<C,G> gf)
@InterfaceAudience.Private public AbstractCounters(AbstractCounters<C1,G1> counters, org.apache.hadoop.mapreduce.counters.CounterGroupFactory<C,G> groupFactory)
C1
- type of the other counterG1
- type of the other counter groupcounters
- the counters object to copygroupFactory
- the factory for new groupspublic C findCounter(String groupName, String counterName)
groupName
- of the countercounterName
- name of the counterpublic C findCounter(Enum<?> key)
key
- the counter keypublic Iterable<String> getGroupNames()
public Iterator<G> iterator()
iterator
in interface Iterable<G extends CounterGroupBase<C>>
public G getGroup(String groupName)
groupName
- name of the grouppublic int countCounters()
public void write(DataOutput out) throws IOException
write
in interface Writable
out
- DataOuput
to serialize this object into.IOException
public void readFields(DataInput in) throws IOException
Writable
in
.
For efficiency, implementations should attempt to re-use storage in the existing object where possible.
readFields
in interface Writable
in
- DataInput
to deseriablize this object from.IOException
public String toString()
public void incrAllCounters(AbstractCounters<C,G> other)
other
- the other Counters instanceCopyright © 2020 Apache Software Foundation. All rights reserved.