本文整理汇总了Java中org.jrobin.core.ConsolFuns类的典型用法代码示例。如果您正苦于以下问题:Java ConsolFuns类的具体用法?Java ConsolFuns怎么用?Java ConsolFuns使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConsolFuns类属于org.jrobin.core包,在下文中一共展示了ConsolFuns类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initGraphSource
import org.jrobin.core.ConsolFuns; //导入依赖的package包/类
private void initGraphSource(RrdGraphDef graphDef, int height, boolean maxHidden) {
final String dataSourceName = getDataSourceName();
final String average = "average";
graphDef.datasource(average, rrdFileName, dataSourceName, ConsolFuns.CF_AVERAGE);
graphDef.setMinValue(0);
final String moyenneLabel = I18N.getString("Moyenne");
graphDef.area(average, getPaint(height), moyenneLabel);
graphDef.gprint(average, ConsolFuns.CF_AVERAGE, moyenneLabel + ": %9.0f %S\\r");
//graphDef.gprint(average, ConsolFuns.CF_MIN, "Minimum: %9.0f %S\\r");
if (!maxHidden) {
final String max = "max";
graphDef.datasource(max, rrdFileName, dataSourceName, "MAX");
final String maximumLabel = I18N.getString("Maximum");
graphDef.line(max, Color.BLUE, maximumLabel);
graphDef.gprint(max, ConsolFuns.CF_MAX, maximumLabel + ": %9.0f %S\\r");
}
// graphDef.comment("JRobin :: RRDTool Choice for the Java World");
}
示例2: determineConsolidationFun
import org.jrobin.core.ConsolFuns; //导入依赖的package包/类
private String determineConsolidationFun(Statistic.Type type) {
switch (type) {
case count:
return ConsolFuns.CF_LAST;
default:
return ConsolFuns.CF_AVERAGE;
}
}
示例3: getData
import org.jrobin.core.ConsolFuns; //导入依赖的package包/类
@Override
public double[][] getData(long startTime, long endTime, int dataPoints) {
// Our greatest datapoints is 60 so if it is something less than that
// then we want an average.
return fetchData((dataPoints != 60 ? ConsolFuns.CF_AVERAGE : consolidationFunction),
startTime, endTime, dataPoints);
}
示例4: getData
import org.jrobin.core.ConsolFuns; //导入依赖的package包/类
@Override
public double[][] getData(long startTime, long endTime, int dataPoints) {
// Our greatest datapoints is 60 so if it is something less than that
// then we want an average.
return fetchData((dataPoints != 60 ? ConsolFuns.CF_AVERAGE : consolidationFunction),
startTime, endTime, dataPoints);
}
示例5: init
import org.jrobin.core.ConsolFuns; //导入依赖的package包/类
private void init() throws IOException, RrdException {
final File rrdFile = new File(rrdFileName);
final File rrdDirectory = rrdFile.getParentFile();
if (!rrdDirectory.mkdirs() && !rrdDirectory.exists()) {
throw new IOException(
"JavaMelody directory can't be created: " + rrdDirectory.getPath());
}
// cf issue 41: rrdFile could have been created with length 0 if out of disk space
// (fix IOException: Read failed, file xxx.rrd not mapped for I/O)
if (!rrdFile.exists() || rrdFile.length() == 0) {
// create RRD file since it does not exist (or is empty)
final RrdDef rrdDef = new RrdDef(rrdFileName, step);
// "startTime" décalé de "step" pour éviter que addValue appelée juste
// après ne lance l'exception suivante la première fois
// "Bad sample timestamp x. Last update time was x, at least one second step is required"
rrdDef.setStartTime(Util.getTime() - step);
// single gauge datasource
final String dsType = "GAUGE";
// max time before "unknown value"
final int heartbeat = step * 2;
rrdDef.addDatasource(getDataSourceName(), dsType, heartbeat, 0, Double.NaN);
// several archives
final String average = ConsolFuns.CF_AVERAGE;
final String max = ConsolFuns.CF_MAX;
// 1 jour
rrdDef.addArchive(average, 0.25, 1, DAY / step);
rrdDef.addArchive(max, 0.25, 1, DAY / step);
// 1 semaine
rrdDef.addArchive(average, 0.25, HOUR / step, 7 * 24);
rrdDef.addArchive(max, 0.25, HOUR / step, 7 * 24);
// 1 mois
rrdDef.addArchive(average, 0.25, 6 * HOUR / step, 31 * 4);
rrdDef.addArchive(max, 0.25, 6 * HOUR / step, 31 * 4);
// 2 ans (1 an pour période "1 an" et 2 ans pour période "tout")
rrdDef.addArchive(average, 0.25, 8 * 6 * HOUR / step, 2 * 12 * 15);
rrdDef.addArchive(max, 0.25, 8 * 6 * HOUR / step, 2 * 12 * 15);
// create RRD file in the pool
final RrdDb rrdDb = rrdPool.requestRrdDb(rrdDef);
rrdPool.release(rrdDb);
}
}