|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.mapred.Counters
public class Counters
A set of named counters.
Counters represent global counters, defined either by the
Map-Reduce framework or applications. Each Counter can be of
any Enum type.
Counters are bunched into Counters.Groups, each comprising of
counters from a particular Enum class.
| Nested Class Summary | |
|---|---|
static class |
Counters.Counter
A counter record, comprising its name and value. |
static class |
Counters.Group
Group of counters, comprising of counters from a particular
counter Enum class. |
| Constructor Summary | |
|---|---|
Counters()
|
|
| Method Summary | |
|---|---|
Counters.Counter |
findCounter(Enum key)
Find the counter for the given enum. |
Counters.Counter |
findCounter(String group,
int id,
String name)
Find a counter by using strings |
long |
getCounter(Enum key)
Returns current value of the specified counter, or 0 if the counter does not exist. |
Counters.Group |
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. |
void |
incrAllCounters(Counters other)
Increments multiple counters by their amounts in another Counters instance. |
void |
incrCounter(Enum key,
long amount)
Increments the specified counter by the specified amount, creating it if it didn't already exist. |
Iterator<Counters.Group> |
iterator()
|
void |
log(org.apache.commons.logging.Log log)
Logs the current counter values. |
String |
makeCompactString()
Convert a counters object into a single line that is easy to parse. |
void |
readFields(DataInput in)
Read a set of groups. |
int |
size()
Returns the total number of counters, by summing the number of counters in each group. |
static Counters |
sum(Counters a,
Counters b)
Convenience method for computing the sum of two sets of counters. |
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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Counters()
| Method Detail |
|---|
public Collection<String> getGroupNames()
public Iterator<Counters.Group> iterator()
iterator in interface Iterable<Counters.Group>public Counters.Group getGroup(String groupName)
public Counters.Counter findCounter(Enum key)
key - the counter key
public Counters.Counter findCounter(String group,
int id,
String name)
group - the name of the groupid - the id of the counter within the group (0 to N-1)name - the internal name of the counter
public void incrCounter(Enum key,
long amount)
key - identifies a counteramount - amount by which counter is to be incrementedpublic long getCounter(Enum key)
public void incrAllCounters(Counters other)
other - the other Counters instance
public static Counters sum(Counters a,
Counters b)
public int size()
public void write(DataOutput out)
throws IOException
write in interface Writableout - DataOuput to serialize this object into.
IOException
public void readFields(DataInput in)
throws IOException
readFields in interface Writablein - DataInput to deseriablize this object from.
IOExceptionpublic void log(org.apache.commons.logging.Log log)
log - The log to use.public String toString()
toString in class Objectpublic String makeCompactString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||