void appendXml(XmlWriter writer) throws IOException { writer.writeComment(signature.get()); writer.writeTag("version", RRDTOOL_VERSION3); writer.writeComment("Seconds"); writer.writeTag("step", step.get()); writer.writeComment(Util.getDate(lastUpdateTime.get())); writer.writeTag("lastupdate", lastUpdateTime.get()); }
/** * 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); }
Datasource(RrdDb parentDb, DataImporter reader, int dsIndex) throws IOException { this(parentDb, null); dsName.set(reader.getDsName(dsIndex)); dsType.set(reader.getDsType(dsIndex)); heartbeat.set(reader.getHeartbeat(dsIndex)); minValue.set(reader.getMinValue(dsIndex)); maxValue.set(reader.getMaxValue(dsIndex)); lastValue.set(reader.getLastValue(dsIndex)); accumValue.set(reader.getAccumValue(dsIndex)); nanSeconds.set(reader.getNanSeconds(dsIndex)); }
void appendXml(XmlWriter writer) throws IOException { writer.startTag("ds"); writer.writeTag("name", dsName.get()); writer.writeTag("type", dsType.name()); writer.writeTag("minimal_heartbeat", heartbeat.get()); writer.writeTag("min", minValue.get()); writer.writeTag("max", maxValue.get()); writer.writeComment("PDP Status"); writer.writeTag("last_ds", lastValue.get(), "UNKN"); writer.writeTag("value", accumValue.get()); writer.writeTag("unknown_sec", nanSeconds.get()); writer.closeTag(); // ds }
String dump() throws IOException { StringBuilder sb = new StringBuilder("== ARCHIVE ==\n"); sb.append("RRA:").append(consolFun.get()).append(":").append(xff.get()).append(":").append(steps.get()).append(":").append(rows.get()).append("\n"); sb.append("interval [").append(getStartTime()).append(", ").append(getEndTime()).append("]" + "\n"); for (int i = 0; i < robins.length; i++) { sb.append(states[i].dump()); sb.append(robins[i].dump()); } return sb.toString(); }
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; }
Def(String name, String dsName, FetchData fetchData) { this(name, fetchData.getRequest().getParentDb().getPath(), dsName, fetchData.getRequest().getConsolFun(), fetchData.getRequest().getParentDb().getRrdBackend().getFactory() ); this.fetchData = fetchData; }
RrdNode(RrdDb rrd, int dsIndex, int arcIndex) throws IOException { // archive node this.dsIndex = dsIndex; this.arcIndex = arcIndex; ArcDef[] arcDefs = rrd.getRrdDef().getArcDefs(); label = arcDefs[arcIndex].dump(); }
RrdPrimitive(RrdUpdater<U> updater, int type, int count, boolean isConstant) throws IOException { this.backend = updater.getRrdBackend(); this.byteCount = RRD_PRIM_SIZES[type] * count; this.pointer = updater.getRrdAllocator().allocate(byteCount); this.cachingAllowed = isConstant || backend.isCachingAllowed(); }
final void archive(Datasource datasource, double value, long numUpdates) throws IOException { int dsIndex = getDsIndex(datasource.getName()); for (Archive archive : archives) { archive.archive(dsIndex, value, numUpdates); } }
/** * Returns archive time step in seconds. Archive step is equal to RRD step * multiplied with the number of archive steps. * * @return Archive time step in seconds * @throws java.io.IOException Thrown in case of I/O error. */ public long getArcStep() throws IOException { return parentDb.getHeader().getStep() * steps.get(); }
void validateHeader() throws IOException { if (!isRrd4jHeader()) { throw new InvalidRrdException("Invalid file header. File [" + parentDb.getCanonicalPath() + "] is not a RRD4J RRD file"); } }
Datasource(RrdDb parentDb, DataImporter reader, int dsIndex) throws IOException { this(parentDb, null); dsName.set(reader.getDsName(dsIndex)); dsType.set(reader.getDsType(dsIndex)); heartbeat.set(reader.getHeartbeat(dsIndex)); minValue.set(reader.getMinValue(dsIndex)); maxValue.set(reader.getMaxValue(dsIndex)); lastValue.set(reader.getLastValue(dsIndex)); accumValue.set(reader.getAccumValue(dsIndex)); nanSeconds.set(reader.getNanSeconds(dsIndex)); }
void appendXml(XmlWriter writer) throws IOException { writer.writeComment(signature.get()); writer.writeTag("version", RRDTOOL_VERSION); writer.writeComment("Seconds"); writer.writeTag("step", step.get()); writer.writeComment(Util.getDate(lastUpdateTime.get())); writer.writeTag("lastupdate", lastUpdateTime.get()); }
/** * 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); }
RrdPrimitive(RrdUpdater updater, int type, int count, boolean isConstant) throws IOException { this.backend = updater.getRrdBackend(); this.byteCount = RRD_PRIM_SIZES[type] * count; this.pointer = updater.getRrdAllocator().allocate(byteCount); this.cachingAllowed = isConstant || backend.isCachingAllowed(); }