/** * Returns index of Archive object with the given consolidation function and the number * of steps. Exception is thrown if such archive could not be found. * * @param consolFun Consolidation function * @param steps Number of archive steps * @return Requested Archive object * @throws IOException Thrown in case of I/O error */ public int getArcIndex(ConsolFun consolFun, int steps) throws IOException { for (int i = 0; i < archives.length; i++) { if (archives[i].getConsolFun() == consolFun && archives[i].getSteps() == steps) { return i; } } throw new IllegalArgumentException("Could not find archive " + consolFun + "/" + steps); }
/** * Returns index of Archive object with the given consolidation function and the number * of steps. Exception is thrown if such archive could not be found. * * @param consolFun Consolidation function * @param steps Number of archive steps * @return Requested Archive object * @throws java.io.IOException Thrown in case of I/O error */ public int getArcIndex(ConsolFun consolFun, int steps) throws IOException { for (int i = 0; i < archives.length; i++) { if (archives[i].getConsolFun() == consolFun && archives[i].getSteps() == steps) { return i; } } throw new IllegalArgumentException("Could not find archive " + consolFun + "/" + steps); }
static int getMatchingArchiveIndex(RrdDb rrd1, int arcIndex, RrdDb rrd2) throws IOException { Archive archive = rrd1.getArchive(arcIndex); ConsolFun consolFun = archive.getConsolFun(); int steps = archive.getSteps(); try { return rrd2.getArcIndex(consolFun, steps); } catch (IllegalArgumentException e) { return -1; } }
static int getMatchingArchiveIndex(RrdDb rrd1, int arcIndex, RrdDb rrd2) throws IOException { Archive archive = rrd1.getArchive(arcIndex); ConsolFun consolFun = archive.getConsolFun(); int steps = archive.getSteps(); try { return rrd2.getArcIndex(consolFun, steps); } catch (IllegalArgumentException e) { return -1; } }
if (archives[i].getConsolFun().toString().equals(consolFun)) { arcStep = archives[i].getArcStep(); diff = Math.abs(resolution - arcStep);
if (archives[i].getConsolFun().toString().equals(consolFun)) { arcStep = archives[i].getArcStep(); diff = Math.abs(resolution - arcStep);
final void archive(Datasource datasource, double value, double lastValue, long numUpdates) throws IOException { int dsIndex = getDsIndex(datasource.getName()); for (Archive archive : archives) { if (ConsolFun.AVERAGE.equals(archive.getConsolFun())) { archive.archive(dsIndex, value, numUpdates); } else { archive.archive(dsIndex, lastValue, numUpdates); } } }
private void finalizeStep(ArcState state, Robin robin) throws IOException { // should store long arcSteps = steps.get(); double arcXff = xff.get(); long nanSteps = state.getNanSteps(); //double nanPct = (double) nanSteps / (double) arcSteps; double accumValue = state.getAccumValue(); if (nanSteps <= arcXff * arcSteps && !Double.isNaN(accumValue)) { if (getConsolFun() == ConsolFun.AVERAGE) { accumValue /= (arcSteps - nanSteps); } robin.store(accumValue); } else { robin.store(Double.NaN); } state.setAccumValue(Double.NaN); state.setNanSteps(0); }
long bestMatch = 0; for (Archive archive : archives) { if (archive.getConsolFun() == consolFun) { long arcStep = archive.getArcStep(); long arcStart = archive.getStartTime() - arcStep;
long bestStepDiff = 0, bestMatch = 0; for (Archive archive : archives) { if (archive.getConsolFun() == consolFun) { long arcStep = archive.getArcStep(); long arcStart = archive.getStartTime() - arcStep;
for(int i = 0; i < rrdSource.getArcCount(); i++) { Archive srcArchive = rrdSource.getArchive(i); ConsolFun consolFun = srcArchive.getConsolFun(); int steps = srcArchive.getSteps(); Archive dstArchive = rrdDest.getArchive(consolFun, steps); if(dstArchive != null) { if(dstArchive.getConsolFun().equals(srcArchive.getConsolFun()) && dstArchive.getSteps() == srcArchive.getSteps()) { for(int k = 0; k < dsCount; k++) { Datasource srcDs = rrdSource.getDatasource(k);
ArcState state = arc.getArcState(dsIndex); values = new Object[]{ arc.getConsolFun(), "" + arc.getXff(), "" + arc.getSteps(),
ArcDef arcDef = new ArcDef(archive.getConsolFun(), archive.getXff(), archive.getSteps(), archive.getRows()); rrdDef.addArchive(arcDef);
ArcDef arcDef = new ArcDef(archive.getConsolFun(), archive.getXff(), archive.getSteps(), archive.getRows()); rrdDef.addArchive(arcDef);