本文整理汇总了Java中org.apache.hadoop.mapred.StatisticsCollector.Stat.TimeStat类的典型用法代码示例。如果您正苦于以下问题:Java TimeStat类的具体用法?Java TimeStat怎么用?Java TimeStat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TimeStat类属于org.apache.hadoop.mapred.StatisticsCollector.Stat包,在下文中一共展示了TimeStat类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createStat
import org.apache.hadoop.mapred.StatisticsCollector.Stat.TimeStat; //导入依赖的package包/类
synchronized Stat createStat(String name, TimeWindow[] windows) {
if (statistics.get(name) != null) {
throw new RuntimeException("Stat with name "+ name +
" is already defined");
}
Map<TimeWindow, TimeStat> timeStats =
new LinkedHashMap<TimeWindow, TimeStat>();
for (TimeWindow window : windows) {
StatUpdater collector = updaters.get(window);
if (collector == null) {
if(SINCE_START.equals(window)) {
collector = new StatUpdater();
} else {
collector = new TimeWindowStatUpdater(window, period);
}
updaters.put(window, collector);
}
TimeStat timeStat = new TimeStat();
collector.addTimeStat(name, timeStat);
timeStats.put(window, timeStat);
}
Stat stat = new Stat(name, timeStats);
statistics.put(name, stat);
return stat;
}
示例2: update
import org.apache.hadoop.mapred.StatisticsCollector.Stat.TimeStat; //导入依赖的package包/类
synchronized void update() {
for (TimeStat stat : statToCollect.values()) {
stat.updates++;
if (stat.updates == updatesPerBucket) {
stat.addBucket();
stat.updates = 0;
}
if (stat.buckets.size() > collectBuckets) {
stat.removeBucket();
}
}
}
示例3: Stat
import org.apache.hadoop.mapred.StatisticsCollector.Stat.TimeStat; //导入依赖的package包/类
private Stat(String name, Map<TimeWindow, TimeStat> timeStats) {
this.name = name;
this.timeStats = timeStats;
}
示例4: inc
import org.apache.hadoop.mapred.StatisticsCollector.Stat.TimeStat; //导入依赖的package包/类
public synchronized void inc(int incr) {
for (TimeStat ts : timeStats.values()) {
ts.inc(incr);
}
}
示例5: getValues
import org.apache.hadoop.mapred.StatisticsCollector.Stat.TimeStat; //导入依赖的package包/类
public synchronized Map<TimeWindow, TimeStat> getValues() {
return Collections.unmodifiableMap(timeStats);
}
示例6: addTimeStat
import org.apache.hadoop.mapred.StatisticsCollector.Stat.TimeStat; //导入依赖的package包/类
synchronized void addTimeStat(String name, TimeStat s) {
statToCollect.put(name, s);
}
示例7: removeTimeStat
import org.apache.hadoop.mapred.StatisticsCollector.Stat.TimeStat; //导入依赖的package包/类
synchronized TimeStat removeTimeStat(String name) {
return statToCollect.remove(name);
}
示例8: update
import org.apache.hadoop.mapred.StatisticsCollector.Stat.TimeStat; //导入依赖的package包/类
synchronized void update() {
for (TimeStat stat : statToCollect.values()) {
stat.setValueToCurrent();
}
}