public static void generateReport(String dataFileName) throws IOException { List<DescriptiveStatistics> statisticsList = new ArrayList<>(); String dataString; BufferedReader dataReader = new BufferedReader(new FileReader(dataFileName)); // First line is treated as header String[] columns = dataReader.readLine().split("\\s+"); int numColumns = columns.length; for (int i = 0; i < numColumns; ++i) { statisticsList.add(new DescriptiveStatistics()); } while ((dataString = dataReader.readLine()) != null) { String[] dataArray = dataString.trim().split(" "); if (dataArray.length != numColumns) { throw new RuntimeException( "Row has missing columns: " + Arrays.toString(dataArray) + " Expected: " + numColumns + " columns."); } for (int i = 0; i < dataArray.length; ++i) { double data = Double.valueOf(dataArray[i]); statisticsList.get(i).addValue(data); } } for (int i = 0; i < numColumns; i++) { LOGGER.info("Stats: {}: {}", columns[i], statisticsList.get(i).toString().replace("\n", "\t")); } }
protected void printSegmentAssignment(Map<String, Map<String, String>> mapping) throws Exception { LOGGER.info(JsonUtils.objectToPrettyString(mapping)); Map<String, List<String>> serverToSegmentMapping = new TreeMap<>(); for (String segment : mapping.keySet()) { Map<String, String> serverToStateMap = mapping.get(segment); for (String server : serverToStateMap.keySet()) { if (!serverToSegmentMapping.containsKey(server)) { serverToSegmentMapping.put(server, new ArrayList<>()); } serverToSegmentMapping.get(server).add(segment); } } DescriptiveStatistics stats = new DescriptiveStatistics(); for (String server : serverToSegmentMapping.keySet()) { List<String> list = serverToSegmentMapping.get(server); LOGGER.info("server " + server + " has " + list.size() + " segments"); stats.addValue(list.size()); } LOGGER.info("Segment Distrbution stat"); LOGGER.info(stats.toString()); }
public FailureDetector(long minimumSamples, int windowSize, String distribution) { descriptiveStatistics = new DescriptiveStatistics(windowSize); this.minimumSamples = minimumSamples; this.distribution = distribution; }
private DescriptiveStatistics computeStats() { final DescriptiveStatistics ds = new DescriptiveStatistics(); allScores.forEachValue(new TDoubleProcedure() { @Override public boolean execute(double value) { ds.addValue(value); return true; } }); return ds; }
/** * Returns a copy of this DescriptiveStatistics instance with the same internal state. * * @return a copy of this */ public DescriptiveStatistics copy() { DescriptiveStatistics result = new DescriptiveStatistics(); copy(this, result); return result; }
/** * Default constructor. * * @param name * name of this measure */ public ChartSeries1DMeasure(String name) { super(name); this.data = new DescriptiveStatistics(); this.data.setWindowSize(DEFAULT_WINDOW_SIZE); }
public void reset() { currentStrategy = initialStrategy; switch(currentStrategy) { case HEURISTIC: adaptiveHistogram = new AdaptiveHistogram(); break; case AUTO: case EXACT: descriptiveStatistics = new DescriptiveStatistics(); } }
/** * Default constructor. * * @param name * names of the measure */ public ChartSeries2DMeasure(String name) { super(name); this.xData = new DescriptiveStatistics(); this.yData = new DescriptiveStatistics(); this.xData.setWindowSize(DEFAULT_WINDOW_SIZE); this.yData.setWindowSize(DEFAULT_WINDOW_SIZE); }
public void latency(String catagoryName, String name, long sample) { Map<String, DescriptiveStatistics> catagory = latencyCatagories.get(catagoryName); if (catagory == null) { catagory = new ConcurrentHashMap<>(); latencyCatagories.put(catagoryName, catagory); } DescriptiveStatistics descriptiveStatistics = catagory.get(name); if (descriptiveStatistics == null) { descriptiveStatistics = new DescriptiveStatistics(STATS_WINDOW); catagory.put(name, descriptiveStatistics); } descriptiveStatistics.addValue(sample); }
/** * Default constructor. * * @param name * name of this measure */ public ChartSeries1DMeasure(String name) { super(name); this.data = new DescriptiveStatistics(); this.data.setWindowSize(DEFAULT_WINDOW_SIZE); }
private DescriptiveStatistics computeStats() { final DescriptiveStatistics ds = new DescriptiveStatistics(); allScores.forEachValue(new TDoubleProcedure() { @Override public boolean execute(double value) { ds.addValue(value); return true; } }); return ds; }
/** * Returns a copy of this DescriptiveStatistics instance with the same internal state. * * @return a copy of this */ public DescriptiveStatistics copy() { DescriptiveStatistics result = new DescriptiveStatistics(); copy(this, result); return result; }
/** * Default constructor. * * @param name * names of the measure */ public ChartSeries2DMeasure(String name) { super(name); this.xData = new DescriptiveStatistics(); this.yData = new DescriptiveStatistics(); this.xData.setWindowSize(DEFAULT_WINDOW_SIZE); this.yData.setWindowSize(DEFAULT_WINDOW_SIZE); }
public NumberAnalyzerColumnDelegate(final boolean descriptiveStatistics, final RowAnnotationFactory annotationFactory) { _annotationFactory = annotationFactory; _nullAnnotation = _annotationFactory.createAnnotation(); _maxAnnotation = _annotationFactory.createAnnotation(); _minAnnotation = _annotationFactory.createAnnotation(); if (descriptiveStatistics) { _statistics = new DescriptiveStatistics(); } else { _statistics = new SummaryStatistics(); } }
public NumberAnalyzerColumnDelegate(boolean descriptiveStatistics, RowAnnotationFactory annotationFactory) { _annotationFactory = annotationFactory; _nullAnnotation = _annotationFactory.createAnnotation(); _maxAnnotation = _annotationFactory.createAnnotation(); _minAnnotation = _annotationFactory.createAnnotation(); if (descriptiveStatistics) { _statistics = new DescriptiveStatistics(); } else { _statistics = new SummaryStatistics(); } }
public static String testSpeed(HashMethod hm, List<List<byte[]>> hashData, int hashesPerRound, int m, int k, int rounds) { DescriptiveStatistics speed = new DescriptiveStatistics(); HashFunction hf = hm.getHashFunction(); int hashRounds = hashesPerRound / k; Random r = new Random(); for (int i = 0; i < rounds; i++) { List<byte[]> data = hashData.get(i); long start_hash = System.nanoTime(); for (int i1 = 0; i1 < hashRounds; i1++) { int[] hashes = hf.hash(data.get(i1), m, k); } long end_hash = System.nanoTime(); speed.addValue((1.0 * end_hash - start_hash) / 1000000); } System.out.println("HashMethod : " + hm + ", " + " hashes = " + hashesPerRound + ", size = " + m + ", hashes = " + k + ", rounds = " + rounds); //System.out.println(speed); return Arrays.toString(speed.getValues()).replace("[", "{").replace("]", "}"); }
private double getGcRatio(List<TaskExecutionAPIEntity> tasks) { if (tasks.isEmpty()) { return 0; } double[] gcMs = ResourceUtils.getCounterValues(tasks, JobCounters.CounterName.GC_MILLISECONDS); double[] cpuMs = ResourceUtils.getCounterValues(tasks, JobCounters.CounterName.CPU_MILLISECONDS); DescriptiveStatistics statistics = new DescriptiveStatistics(); double averageCpuMs = statistics.getMeanImpl().evaluate(cpuMs); double averageGcMs = statistics.getMeanImpl().evaluate(gcMs); if (averageCpuMs == 0) { averageCpuMs = 1; } return averageGcMs / averageCpuMs; }
public DateAndTimeAnalyzerColumnDelegate(final boolean descriptiveStatistics, final RowAnnotationFactory annotationFactory) { _annotationFactory = annotationFactory; _nullAnnotation = _annotationFactory.createAnnotation(); _maxDateAnnotation = _annotationFactory.createAnnotation(); _minDateAnnotation = _annotationFactory.createAnnotation(); _maxTimeAnnotation = _annotationFactory.createAnnotation(); _minTimeAnnotation = _annotationFactory.createAnnotation(); _numRows = 0; if (descriptiveStatistics) { _statistics = new DescriptiveStatistics(); } else { _statistics = new SummaryStatistics(); } }
public DateAndTimeAnalyzerColumnDelegate(boolean descriptiveStatistics, RowAnnotationFactory annotationFactory) { _annotationFactory = annotationFactory; _nullAnnotation = _annotationFactory.createAnnotation(); _maxDateAnnotation = _annotationFactory.createAnnotation(); _minDateAnnotation = _annotationFactory.createAnnotation(); _maxTimeAnnotation = _annotationFactory.createAnnotation(); _minTimeAnnotation = _annotationFactory.createAnnotation(); _numRows = 0; if (descriptiveStatistics) { _statistics = new DescriptiveStatistics(); } else { _statistics = new SummaryStatistics(); } }
@Override public JobSuggestionResponse apply(TaskGroupResponse data) { MRTaskExecutionResponse.TaskGroup taskGroup = getTasks(data); double[] smallerGroup = ResourceUtils.getCounterValues(taskGroup.shortTasks, counterName); double[] largerGroup = ResourceUtils.getCounterValues(taskGroup.longTasks, counterName); DescriptiveStatistics statistics = new DescriptiveStatistics(); double avgSmaller = statistics.getMeanImpl().evaluate(smallerGroup); double avgLarger = statistics.getMeanImpl().evaluate(largerGroup); List<MRTaskExecutionResponse.SuggestionResult> suggestionResults = getDeviationSuggest(avgSmaller, avgLarger); MRTaskExecutionResponse.JobSuggestionResponse response = new MRTaskExecutionResponse.JobSuggestionResponse(); response.suggestionResults = suggestionResults; response.suggestionType = suggestType.toString(); return response; }