public synchronized void inc(int incr) { for (TimeStat ts : timeStats.values()) { ts.inc(incr); } }
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; }
JobTrackerStatistics.TaskTrackerStat ttStat = tracker.getStatistics(). getTaskTrackerStat(tt.getTrackerName()); out.println("</td><td>" + ttStat.totalTasksStat.getValues(). get(window).getValue()); out.println("</td><td>" + ttStat.succeededTasksStat.getValues(). get(window).getValue()); out.println("</td><td>" + ttStat.healthCheckFailedStat. getValues().get(window).getValue());
stat.inc(3); collector.update(); assertEquals(0, stat.getValues().get(window).getValue()); assertEquals(3, stat.getValues().get(sincStart).getValue()); stat.inc(3); collector.update(); assertEquals((3+3), stat.getValues().get(window).getValue()); assertEquals(6, stat.getValues().get(sincStart).getValue()); stat.inc(10); collector.update(); assertEquals((3+3), stat.getValues().get(window).getValue()); assertEquals(16, stat.getValues().get(sincStart).getValue()); stat.inc(10); collector.update(); assertEquals((3+3+10+10), stat.getValues().get(window).getValue()); assertEquals(26, stat.getValues().get(sincStart).getValue()); stat.inc(10); collector.update(); stat.inc(10); collector.update(); assertEquals((3+3+10+10+10+10), stat.getValues().get(window).getValue()); assertEquals(46, stat.getValues().get(sincStart).getValue()); stat.inc(10); collector.update();
stat.inc(3); collector.update(); assertEquals(0, stat.getValues().get(window).getValue()); assertEquals(3, stat.getValues().get(sincStart).getValue()); stat.inc(3); collector.update(); assertEquals((3+3), stat.getValues().get(window).getValue()); assertEquals(6, stat.getValues().get(sincStart).getValue()); stat.inc(10); collector.update(); assertEquals((3+3), stat.getValues().get(window).getValue()); assertEquals(16, stat.getValues().get(sincStart).getValue()); stat.inc(10); collector.update(); assertEquals((3+3+10+10), stat.getValues().get(window).getValue()); assertEquals(26, stat.getValues().get(sincStart).getValue()); stat.inc(10); collector.update(); stat.inc(10); collector.update(); assertEquals((3+3+10+10+10+10), stat.getValues().get(window).getValue()); assertEquals(46, stat.getValues().get(sincStart).getValue()); stat.inc(10); collector.update();
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; }
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; }
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; }
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; }
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; }
public synchronized void inc() { inc(1); }
synchronized void incrSucceededTasks() { succeededTasksStat.inc(); }
synchronized void incrHealthCheckFailed() { healthCheckFailedStat.inc(); }
public synchronized void inc() { inc(1); }
public synchronized void inc() { inc(1); }
synchronized void incrSucceededTasks() { succeededTasksStat.inc(); }
synchronized void incrTotalTasks() { totalTasksStat.inc(); }
synchronized void incrTotalTasks() { totalTasksStat.inc(); }
public synchronized void inc() { inc(1); }
public synchronized void inc() { inc(1); }