/** * Returns current starting timestamp. This value is not constant. * * @return Timestamp corresponding to the first archive row * @throws IOException Thrown in case of I/O error. */ public long getStartTime() throws IOException { long endTime = getEndTime(); long arcStep = getArcStep(); long numRows = rows.get(); return endTime - (numRows - 1) * arcStep; }
/** * Returns current starting timestamp. This value is not constant. * * @return Timestamp corresponding to the first archive row * @throws java.io.IOException Thrown in case of I/O error. */ public long getStartTime() throws IOException { long endTime = getEndTime(); long arcStep = getArcStep(); long numRows = rows.get(); return endTime - (numRows - 1) * arcStep; }
/** * Returns current ending timestamp. This value is not constant. * * @return Timestamp corresponding to the last archive row * @throws java.io.IOException Thrown in case of I/O error. */ public long getEndTime() throws IOException { long arcStep = getArcStep(); long lastUpdateTime = parentDb.getHeader().getLastUpdateTime(); return Util.normalize(lastUpdateTime, arcStep); }
/** * Returns current ending timestamp. This value is not constant. * * @return Timestamp corresponding to the last archive row * @throws IOException Thrown in case of I/O error. */ public long getEndTime() throws IOException { long arcStep = getArcStep(); long lastUpdateTime = parentDb.getHeader().getLastUpdateTime(); return Util.normalize(lastUpdateTime, arcStep); }
FetchData(Archive matchingArchive, FetchRequest request) throws IOException { this.matchingArchive = matchingArchive; this.arcStep = matchingArchive.getArcStep(); this.arcEndTime = matchingArchive.getEndTime(); this.dsNames = request.getFilter(); if (this.dsNames == null) { this.dsNames = matchingArchive.getParentDb().getDsNames(); } this.request = request; }
arcStep = archives[i].getArcStep(); diff = Math.abs(resolution - arcStep);
arcStep = archives[i].getArcStep(); diff = Math.abs(resolution - arcStep);
FetchData(Archive matchingArchive, FetchRequest request) throws IOException { this.matchingArchive = matchingArchive; this.arcStep = matchingArchive.getArcStep(); this.arcEndTime = matchingArchive.getEndTime(); this.dsNames = request.getFilter(); if (this.dsNames == null) { this.dsNames = matchingArchive.getParentDb().getDsNames(); } this.request = request; }
for (Archive archive : archives) { if (archive.getConsolFun() == consolFun) { long arcStep = archive.getArcStep(); long arcStart = archive.getStartTime() - arcStep; long fullMatch = fetchEnd - fetchStart; long tmpStepDiff = Math.abs(archive.getArcStep() - resolution); if (arcStart <= fetchStart) {
for (Archive archive : archives) { if (archive.getConsolFun() == consolFun) { long arcStep = archive.getArcStep(); long arcStart = archive.getStartTime() - arcStep; long arcEnd = archive.getEndTime(); long fullMatch = fetchEnd - fetchStart; if (arcEnd >= fetchEnd && arcStart <= fetchStart) { long tmpStepDiff = Math.abs(archive.getArcStep() - resolution);
Robin robin = arc.getRobin(dsIndex); long start = arc.getStartTime(); long step = arc.getArcStep(); double robinValues[] = robin.getValues(); values = new Object[robinValues.length][];
void archive(int dsIndex, double value, long numUpdates) throws IOException { Robin robin = robins[dsIndex]; ArcState state = states[dsIndex]; long step = parentDb.getHeader().getStep(); long lastUpdateTime = parentDb.getHeader().getLastUpdateTime(); long updateTime = Util.normalize(lastUpdateTime, step) + step; long arcStep = getArcStep(); // finish current step while (numUpdates > 0) { accumulate(state, value); numUpdates--; if (updateTime % arcStep == 0) { finalizeStep(state, robin); break; } else { updateTime += step; } } // update robin in bulk int bulkUpdateCount = (int) Math.min(numUpdates / steps.get(), (long) rows.get()); robin.bulkStore(value, bulkUpdateCount); // update remaining steps long remainingUpdates = numUpdates % steps.get(); for (long i = 0; i < remainingUpdates; i++) { accumulate(state, value); } }
ArcState(Archive parentArc, boolean shouldInitialize) throws IOException { this.parentArc = parentArc; accumValue = new RrdDouble<>(this); nanSteps = new RrdLong<>(this); if (shouldInitialize) { Header header = parentArc.getParentDb().getHeader(); long step = header.getStep(); long lastUpdateTime = header.getLastUpdateTime(); long arcStep = parentArc.getArcStep(); long initNanSteps = (Util.normalize(lastUpdateTime, step) - Util.normalize(lastUpdateTime, arcStep)) / step; accumValue.set(Double.NaN); nanSteps.set(initNanSteps); } }
ArcState(Archive parentArc, boolean shouldInitialize) throws IOException { this.parentArc = parentArc; accumValue = new RrdDouble(this); nanSteps = new RrdLong(this); if (shouldInitialize) { Header header = parentArc.getParentDb().getHeader(); long step = header.getStep(); long lastUpdateTime = header.getLastUpdateTime(); long arcStep = parentArc.getArcStep(); long initNanSteps = (Util.normalize(lastUpdateTime, step) - Util.normalize(lastUpdateTime, arcStep)) / step; accumValue.set(Double.NaN); nanSteps.set(initNanSteps); } }
void archive(int dsIndex, double value, long numUpdates) throws IOException { Robin robin = robins[dsIndex]; ArcState state = states[dsIndex]; long step = parentDb.getHeader().getStep(); long lastUpdateTime = parentDb.getHeader().getLastUpdateTime(); long updateTime = Util.normalize(lastUpdateTime, step) + step; long arcStep = getArcStep(); // finish current step while (numUpdates > 0) { accumulate(state, value); numUpdates--; if (updateTime % arcStep == 0) { finalizeStep(state, robin); break; } else { updateTime += step; } } // update robin in bulk int bulkUpdateCount = (int) Math.min(numUpdates / steps.get(), (long) rows.get()); robin.bulkStore(value, bulkUpdateCount); // update remaining steps long remainingUpdates = numUpdates % steps.get(); for (long i = 0; i < remainingUpdates; i++) { accumulate(state, value); } }
FetchData fetchData(FetchRequest request) throws IOException { long arcStep = getArcStep(); long fetchStart = Util.normalize(request.getFetchStart(), arcStep); long fetchEnd = Util.normalize(request.getFetchEnd(), arcStep);
FetchData fetchData(FetchRequest request) throws IOException { long arcStep = getArcStep(); long fetchStart = Util.normalize(request.getFetchStart(), arcStep); long fetchEnd = Util.normalize(request.getFetchEnd(), arcStep);
void appendXml(XmlWriter writer) throws IOException { writer.startTag("rra"); writer.writeTag("cf", consolFun.get()); writer.writeComment(getArcStep() + " seconds"); writer.writeTag("pdp_per_row", steps.get()); writer.writeTag("xff", xff.get()); writer.startTag("cdp_prep"); for (ArcState state : states) { state.appendXml(writer); } writer.closeTag(); // cdp_prep writer.startTag("database"); long startTime = getStartTime(); for (int i = 0; i < rows.get(); i++) { long time = startTime + i * getArcStep(); writer.writeComment(Util.getDate(time) + " / " + time); writer.startTag("row"); for (Robin robin : robins) { writer.writeTag("v", robin.getValue(i)); } writer.closeTag(); // row } writer.closeTag(); // database writer.closeTag(); // rra }
void appendXml(XmlWriter writer) throws IOException { writer.startTag("rra"); writer.writeTag("cf", consolFun.name()); writer.writeComment(getArcStep() + " seconds"); writer.writeTag("pdp_per_row", steps.get()); writer.startTag("params"); writer.writeTag("xff", xff.get()); writer.closeTag(); // params writer.startTag("cdp_prep"); for (ArcState state : states) { state.appendXml(writer); } writer.closeTag(); // cdp_prep writer.startTag("database"); long startTime = getStartTime(); for (int i = 0; i < rows.get(); i++) { long time = startTime + i * getArcStep(); writer.writeComment(Util.getDate(time) + " / " + time); writer.startTag("row"); for (Robin robin : robins) { writer.writeTag("v", robin.getValue(i)); } writer.closeTag(); // row } writer.closeTag(); // database writer.closeTag(); // rra }
t1 = arc.getStartTime(); t2 = arc.getEndTime(); long step = arc.getArcStep(); int count = robin.getSize(); timestamps = new long[count];