本文整理汇总了Java中org.rrd4j.core.Sample类的典型用法代码示例。如果您正苦于以下问题:Java Sample类的具体用法?Java Sample怎么用?Java Sample使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Sample类属于org.rrd4j.core包,在下文中一共展示了Sample类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMessage
import org.rrd4j.core.Sample; //导入依赖的package包/类
@Override
public synchronized void onMessage(TelemetryMessage message) {
try {
LOGGER.info("onMessage: message[{}]", message);
Sample sample = rrdDb.createSample();
sample.setTime(message.getSampleTime());
sample.setValue("speed", message.getSpeed());
sample.setValue("odometer", message.getOdometerReading());
sample.setValue("batteryPercent", message.getBatteryPercent());
sample.setValue("elevation", message.getElevation());
sample.setValue("estHeading", message.getEstHeading());
sample.setValue("heading", message.getHeading());
sample.setValue("latitude", message.getLatitude());
sample.setValue("longitude", message.getLongitude());
sample.setValue("power", message.getPower());
sample.setValue("ratedRange", message.getRatedRange());
sample.setValue("estRange", message.getEstRange());
sample.update();
} catch (IOException ex) {
LOGGER.error("onMessage: Unable to process message.", ex);
}
}
示例2: store
import org.rrd4j.core.Sample; //导入依赖的package包/类
public static void store(List<Integer> data, RrdDb db) {
StringBuilder sb = new StringBuilder();
for (Integer value : data) {
sb.append(value);
sb.append(':');
}
sb.deleteCharAt(sb.length() - 1);
try {
Sample sample = db.createSample();
sample.setAndUpdate(sb.toString());
} catch (IOException ex) {
Logger.getLogger(RrdHelper.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例3: updateSREventCountGraph
import org.rrd4j.core.Sample; //导入依赖的package包/类
private final void updateSREventCountGraph(RrdDb rrdDb){
try {
Sample sample = rrdDb.createSample();
int j = studentRecordsService.eventCount().getEventCount();
sample.setAndUpdate("NOW:" + j);
rrdDb.close();
} catch (IOException e) {
System.out.println(e);
}
}
示例4: updateMoodleGraph
import org.rrd4j.core.Sample; //导入依赖的package包/类
private final void updateMoodleGraph(RrdDb rrdDb){
try {
Sample sample = rrdDb.createSample();
int j = moodleService.moodleUsers().getMoodleUsersCount();
sample.setAndUpdate("NOW:" + j);
rrdDb.close();
} catch (IOException e) {
System.out.println(e);
}
}
示例5: logIntoRRD
import org.rrd4j.core.Sample; //导入依赖的package包/类
private void logIntoRRD(RrdDb rrdDb, Double value) throws IOException {
Sample sample = rrdDb.createSample();
sample.setValue(name, value);
sample.update();
rrdDb.close();
}