public class Counters extends Object implements Iterable<CounterGroup>, Writable
CounterGroup 组成,保存了所有的 Counter 的信息.Counter,
CounterGroup,
TaskAttemptContext#getCounter(String, String),
RunningJob#getCounters()| Modifier and Type | Method and Description |
|---|---|
int |
countCounters()
返回Counter的个数
|
boolean |
equals(Object genericRight) |
Counter |
findCounter(Enum<?> key)
查找 Counter,给定 enum 对象.
|
Counter |
findCounter(String groupName,
String counterName)
查找 Counter,给定 Counter 组名和 Counter 名
|
CounterGroup |
getGroup(String groupName)
获取给定名字的 Counter 组,若不存在此 Counter 组,则新建一个.
|
Collection<String> |
getGroupNames()
返回 Counter 组名的集合
|
int |
hashCode() |
void |
incrAllCounters(Counters other)
将传入的 Counters 里的 Counter 值与本 Counters 的Counter值相加
|
Iterator<CounterGroup> |
iterator() |
void |
readFields(DataInput in)
从
DataInput 读取 |
String |
toString()
返回Counters的字符串形式.
|
void |
write(DataOutput out)
输出到
DataOutput |
forEach, spliteratorpublic Counters()
public Counters(Counters counters)
public Counter findCounter(String groupName, String counterName)
groupName - Counter 组名counterName - Counter 名称Counter 对象public Counter findCounter(Enum<?> key)
key - enum 对象Counter 对象public Collection<String> getGroupNames()
public Iterator<CounterGroup> iterator()
iterator in interface Iterable<CounterGroup>public CounterGroup getGroup(String groupName)
groupName - Counter 组名public int countCounters()
public String toString()
public void incrAllCounters(Counters other)
other - 待加的Counterspublic void write(DataOutput out) throws IOException
DataOutputwrite in interface WritableIOExceptionpublic void readFields(DataInput in) throws IOException
DataInput 读取readFields in interface WritableIOExceptionCopyright © 2023 Alibaba Cloud Computing. All rights reserved.