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; }
private synchronized void addBucket() { buckets.addLast(currentValue); setValueToCurrent(); }
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());
assertEquals(0, stat.getValues().get(window).getValue()); assertEquals(3, stat.getValues().get(sincStart).getValue()); assertEquals((3+3), stat.getValues().get(window).getValue()); assertEquals(6, stat.getValues().get(sincStart).getValue()); assertEquals((3+3), stat.getValues().get(window).getValue()); assertEquals(16, stat.getValues().get(sincStart).getValue()); assertEquals((3+3+10+10), stat.getValues().get(window).getValue()); assertEquals(26, stat.getValues().get(sincStart).getValue()); stat.inc(10); collector.update(); assertEquals((3+3+10+10+10+10), stat.getValues().get(window).getValue()); assertEquals(46, stat.getValues().get(sincStart).getValue()); assertEquals((3+3+10+10+10+10), stat.getValues().get(window).getValue()); assertEquals(56, stat.getValues().get(sincStart).getValue()); assertEquals((10+10+10+10+10+12), stat.getValues().get(window).getValue()); assertEquals(68, stat.getValues().get(sincStart).getValue()); assertEquals((10+10+10+10+10+12), stat.getValues().get(window).getValue()); assertEquals(81, stat.getValues().get(sincStart).getValue()); assertEquals((10+10+10+12+13+14), stat.getValues().get(window).getValue()); assertEquals(95, stat.getValues().get(sincStart).getValue());
assertEquals(0, stat.getValues().get(window).getValue()); assertEquals(3, stat.getValues().get(sincStart).getValue()); assertEquals((3+3), stat.getValues().get(window).getValue()); assertEquals(6, stat.getValues().get(sincStart).getValue()); assertEquals((3+3), stat.getValues().get(window).getValue()); assertEquals(16, stat.getValues().get(sincStart).getValue()); assertEquals((3+3+10+10), stat.getValues().get(window).getValue()); assertEquals(26, stat.getValues().get(sincStart).getValue()); stat.inc(10); collector.update(); assertEquals((3+3+10+10+10+10), stat.getValues().get(window).getValue()); assertEquals(46, stat.getValues().get(sincStart).getValue()); assertEquals((3+3+10+10+10+10), stat.getValues().get(window).getValue()); assertEquals(56, stat.getValues().get(sincStart).getValue()); assertEquals((10+10+10+10+10+12), stat.getValues().get(window).getValue()); assertEquals(68, stat.getValues().get(sincStart).getValue()); assertEquals((10+10+10+10+10+12), stat.getValues().get(window).getValue()); assertEquals(81, stat.getValues().get(sincStart).getValue()); assertEquals((10+10+10+12+13+14), stat.getValues().get(window).getValue()); assertEquals(95, stat.getValues().get(sincStart).getValue());
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; }
private synchronized void addBucket() { buckets.addLast(currentValue); setValueToCurrent(); }
private synchronized void addBucket() { buckets.addLast(currentValue); setValueToCurrent(); }
private synchronized void addBucket() { buckets.addLast(currentValue); setValueToCurrent(); }
private synchronized void addBucket() { buckets.addLast(currentValue); setValueToCurrent(); }
private synchronized void addBucket() { buckets.addLast(currentValue); setValueToCurrent(); }
private int getFailureCountSinceStart(JobTracker jt, String tracker) { JobTrackerStatistics jtStats = jt.getStatistics(); StatisticsCollector collector = jtStats.collector; collector.update(); return jtStats.getTaskTrackerStat(tracker).healthCheckFailedStat .getValues().get(StatisticsCollector.SINCE_START).getValue(); }