Aggregates getAggregates(long tStart, long tEnd) throws RrdException { Aggregates agg = new Aggregates(); agg.first = agg.last = agg.min = agg.max = agg.average = value; agg.total = value * (tEnd - tStart); return agg; }
/** * Returns single aggregated value for a single datasource. * * @param sourceName Datasource name * @param consolFun Consolidation function to be applied to fetched datasource values. * Valid consolidation functions are MIN, MAX, LAST, FIRST, AVERAGE and TOTAL * (these string constants are conveniently defined in the {@link ConsolFuns} class) * @return MIN, MAX, LAST, FIRST, AVERAGE or TOTAL value calculated from the data * for the given datasource name * @throws RrdException Thrown if invalid datasource name is specified, * or if datasource values are not yet calculated (method {@link #processData()} * was not called) */ public double getAggregate(String sourceName, String consolFun) throws RrdException { Source source = getSource(sourceName); return source.getAggregates(tStart, tEnd).getAggregate(consolFun); }
/** * Same as SDef; the aggregates of a static value are all just the * same static value. * * Assumes this def has been realized by calling calculate(), otherwise * the aggregated values will be NaN */ @Override Aggregates getAggregates(long tStart, long tEnd) throws RrdException { Aggregates agg = new Aggregates(); agg.first = agg.last = agg.min = agg.max = agg.average = m_value; agg.total = m_value * (tEnd - tStart); return agg; }
private void calculateSDef(SDef sDef) throws RrdException { String defName = sDef.getDefName(); String consolFun = sDef.getConsolFun(); Source source = getSource(defName); if (consolFun.equals("MAXIMUM")) { consolFun = "MAX"; } else if (consolFun.equals("MINIMUM")) { consolFun = "MIN"; } double value = source.getAggregates(tStart, tEnd).getAggregate(consolFun); sDef.setValue(value); }
Aggregates getAggregates(long tStart, long tEnd) { Aggregates agg = new Aggregates(); int cnt = 0; int lslstep = 0;
/** * Returns single aggregated value for a single datasource. * * @param sourceName Datasource name * @param consolFun Consolidation function to be applied to fetched datasource values. * Valid consolidation functions are MIN, MAX, LAST, FIRST, AVERAGE and TOTAL * (these string constants are conveniently defined in the {@link ConsolFuns} class) * @return MIN, MAX, LAST, FIRST, AVERAGE or TOTAL value calculated from the data * for the given datasource name * @throws RrdException Thrown if invalid datasource name is specified, * or if datasource values are not yet calculated (method {@link #processData()} * was not called) */ public double getAggregate(String sourceName, String consolFun) throws RrdException { Source source = getSource(sourceName); return source.getAggregates(tStart, tEnd).getAggregate(consolFun); }
Aggregates getAggregates(long tStart, long tEnd) throws RrdException { Aggregates agg = new Aggregates(); agg.first = agg.last = agg.min = agg.max = agg.average = value; agg.total = value * (tEnd - tStart); return agg; }
private void calculateSDef(SDef sDef) throws RrdException { String defName = sDef.getDefName(); String consolFun = sDef.getConsolFun(); Source source = getSource(defName); double value = source.getAggregates(tStart, tEnd).getAggregate(consolFun); sDef.setValue(value); }
Aggregates getAggregates(long tStart, long tEnd) { Aggregates agg = new Aggregates(); long totalSeconds = 0; boolean firstFound = false;