当前位置: 首页>>代码示例>>Java>>正文


Java ConsolFun类代码示例

本文整理汇总了Java中org.rrd4j.ConsolFun的典型用法代码示例。如果您正苦于以下问题:Java ConsolFun类的具体用法?Java ConsolFun怎么用?Java ConsolFun使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConsolFun类属于org.rrd4j包,在下文中一共展示了ConsolFun类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createMoodleDiskWaitGraph

import org.rrd4j.ConsolFun; //导入依赖的package包/类
private static final void createMoodleDiskWaitGraph(String graphLocation,
		String rrdDBLocation) {
	try {
		RrdGraphDef waitGraphDef = new RrdGraphDef();
		waitGraphDef.setTimeSpan(-3600L, -0L);
		waitGraphDef.datasource("linea", rrdDBLocation, "a", ConsolFun.TOTAL);
		waitGraphDef.datasource("lineb", rrdDBLocation, "b", ConsolFun.TOTAL);
		waitGraphDef.line("linea", Color.GREEN, "Average Wait", 3);
		waitGraphDef.line("lineb", Color.BLUE, "Service Wait", 3);
		waitGraphDef.setFilename(graphLocation);
		waitGraphDef.setMaxValue(10);
		RrdGraph waitGraph = new RrdGraph(waitGraphDef);//actually creates the graph for wait.
	} catch (IOException e) {
		System.out.println(e);
	}
}
 
开发者ID:AdamHansrod,项目名称:Graphr,代码行数:17,代码来源:RRD.java

示例2: createUnitDb

import org.rrd4j.ConsolFun; //导入依赖的package包/类
public static RrdDb createUnitDb(int cores, int clusterId, int unitId) throws IOException {
	Logger.getLogger(RrdDbFactory.class.getName()).info("Creating new RRD file: "
			+ RrdHelper.getDbPath(clusterId, unitId));
	RrdDef rrdDef = new RrdDef(RrdHelper.getDbPath(clusterId, unitId));
	rrdDef.setStep(STEP);
	rrdDef.addDatasource(new MonitoredEntity(MonitoredEntityType.CPU_SPEED).getStringId(),
			DsType.GAUGE, TIMEOUT, Double.NaN, Double.NaN);
	for (int i = 0; i < cores; i++) {
		rrdDef.addDatasource(new MonitoredEntity(MonitoredEntityType.CPU_USAGE, i).getStringId(),
				DsType.GAUGE, TIMEOUT, Double.NaN, Double.NaN);
	}
	rrdDef.addDatasource(new MonitoredEntity(MonitoredEntityType.MEMORY).getStringId(),
			DsType.GAUGE, TIMEOUT, Double.NaN, Double.NaN);

	rrdDef.addArchive(ConsolFun.AVERAGE, 0.5,
			RrdHelper.getSampleSize(RrdDbResolution.EXACT),
			RrdHelper.getSampleWindow(RrdDbResolution.EXACT));
	rrdDef.addArchive(ConsolFun.AVERAGE, 0.5,
			RrdHelper.getSampleSize(RrdDbResolution.LOW),
			RrdHelper.getSampleWindow(RrdDbResolution.LOW));

	RrdDb rrdDb = new RrdDb(rrdDef);
	return rrdDb;
}
 
开发者ID:roscisz,项目名称:KernelHive,代码行数:25,代码来源:RrdDbFactory.java

示例3: createGpuDb

import org.rrd4j.ConsolFun; //导入依赖的package包/类
public static RrdDb createGpuDb(int clusterId, int unitId, int deviceId) throws IOException {
	Logger.getLogger(RrdDbFactory.class.getName()).info("Creating new GPU RRD file: "
			+ RrdHelper.getDbPath(clusterId, unitId, deviceId));
	RrdDef rrdDef = new RrdDef(RrdHelper.getDbPath(clusterId, unitId, deviceId));
	rrdDef.setStep(STEP);
	rrdDef.addDatasource(new MonitoredEntity(MonitoredEntityType.GPU_USAGE).getStringId(),
			DsType.GAUGE, TIMEOUT, Double.NaN, Double.NaN);
	rrdDef.addDatasource(new MonitoredEntity(MonitoredEntityType.GPU_GLOBAL_MEMORY).getStringId(),
			DsType.GAUGE, TIMEOUT, Double.NaN, Double.NaN);
	rrdDef.addDatasource(new MonitoredEntity(MonitoredEntityType.FAN).getStringId(),
			DsType.GAUGE, TIMEOUT, 0, 100);
	rrdDef.addArchive(ConsolFun.AVERAGE, 0.5,
			RrdHelper.getSampleSize(RrdDbResolution.EXACT),
			RrdHelper.getSampleWindow(RrdDbResolution.EXACT));
	rrdDef.addArchive(ConsolFun.AVERAGE, 0.5,
			RrdHelper.getSampleSize(RrdDbResolution.LOW),
			RrdHelper.getSampleWindow(RrdDbResolution.LOW));

	RrdDb rrdDb = new RrdDb(rrdDef);
	return rrdDb;
}
 
开发者ID:roscisz,项目名称:KernelHive,代码行数:22,代码来源:RrdDbFactory.java

示例4: query

import org.rrd4j.ConsolFun; //导入依赖的package包/类
public double query(String dsName, long startTimestamp, long endTimestamp, ConsolFun consolidationFunction) {
    long tStart = convertToUnixTimestamp(startTimestamp);
    long tEnd = convertToUnixTimestamp(endTimestamp);
    if (tStart == tEnd) {
        this.logger.warn("Shifting end time by 1 second because it is identical with the start time.");
        tEnd++;
    }
    try {
        final FetchRequest request = this.rrdDb.createFetchRequest(consolidationFunction, tStart, tEnd);
        final FetchData fetchData = request.fetchData();
        return fetchData.getAggregate(dsName, consolidationFunction);
    } catch (IOException e) {
        e.printStackTrace();
        return Double.NaN;
    }
}
 
开发者ID:daqcri,项目名称:rheem,代码行数:17,代码来源:RrdAccessor.java

示例5: generateGraph

import org.rrd4j.ConsolFun; //导入依赖的package包/类
private void generateGraph(RrdDb rrdDb) throws IOException {
	RrdGraphDef gDef = new RrdGraphDef();
	gDef.setWidth(500);
	gDef.setHeight(300);
	gDef.setFilename(name + ".png");
	gDef.setStartTime(startTime);
	gDef.setEndTime(rrdDb.getLastUpdateTime());
	gDef.setTitle(name);
	gDef.setVerticalLabel(physicalQuantity.getUnit());
	gDef.datasource(physicalQuantity.toString(), rrdPath, name, ConsolFun.MAX);
	gDef.line(physicalQuantity.toString(), Color.RED, physicalQuantity.toString() + " max");
	gDef.setImageFormat("png");
	graph = new RrdGraph(gDef);
}
 
开发者ID:SebiGo,项目名称:BrewControlServer,代码行数:15,代码来源:RRD.java

示例6: nodeDispatcherStatsGraph

import org.rrd4j.ConsolFun; //导入依赖的package包/类
@ResponseBody
@RequestMapping(value="/monitor/graphs/node_dsp.png", method=RequestMethod.GET, produces=MediaType.IMAGE_PNG_VALUE)
public byte[] nodeDispatcherStatsGraph() throws IOException {

    final String path = rrdPath(PLOW_RRD);
    final RrdGraphDef graphDef = baseGraph("Node Dispatcher Traffic", "dps/sec");

    graphDef.datasource("linea", path, "nodeDispatchHit", ConsolFun.AVERAGE);
    graphDef.datasource("lineb", path, "nodeDispatchMiss", ConsolFun.AVERAGE);
    graphDef.datasource("linec", path, "nodeDispatchFail", ConsolFun.AVERAGE);
    graphDef.area("linea", new Color(152, 175, 54), "Hit");
    graphDef.area("lineb", new Color(74, 104, 15), "Miss");
    graphDef.area("linec", new Color(164, 11, 23), "Error");

    return createImage(graphDef);
}
 
开发者ID:chadmv,项目名称:plow,代码行数:17,代码来源:RrdGraphController.java

示例7: procDispatcherStatsGraph

import org.rrd4j.ConsolFun; //导入依赖的package包/类
@ResponseBody
@RequestMapping(value="/monitor/graphs/proc_dsp.png", method=RequestMethod.GET, produces=MediaType.IMAGE_PNG_VALUE)
public byte[] procDispatcherStatsGraph() throws IOException {

    final String path = rrdPath(PLOW_RRD);
    final RrdGraphDef graphDef = baseGraph("Proc Dispatcher Traffic", "dps/sec");

    graphDef.datasource("linea", path, "procDispatchHit", ConsolFun.AVERAGE);
    graphDef.datasource("lineb", path, "procDispatchMiss", ConsolFun.AVERAGE);
    graphDef.datasource("linec", path, "procDispatchFail", ConsolFun.AVERAGE);
    graphDef.area("linea", new Color(152, 175, 54), "Hit");
    graphDef.area("lineb", new Color(74, 104, 15), "Miss");
    graphDef.area("linec", new Color(164, 11, 23), "Error");

    return createImage(graphDef);
}
 
开发者ID:chadmv,项目名称:plow,代码行数:17,代码来源:RrdGraphController.java

示例8: taskCountsGraph

import org.rrd4j.ConsolFun; //导入依赖的package包/类
@ResponseBody
@RequestMapping(value="/monitor/graphs/task_exec.png", method=RequestMethod.GET, produces=MediaType.IMAGE_PNG_VALUE)
public byte[] taskCountsGraph() throws IOException {

    final String path = rrdPath(PLOW_RRD);
    final RrdGraphDef graphDef = baseGraph("Task Executions", "task/sec");

    graphDef.datasource("linea", path, "taskStartedCount", ConsolFun.AVERAGE);
    graphDef.datasource("lineb", path, "taskStartedFailCount", ConsolFun.AVERAGE);
    graphDef.datasource("linec", path, "taskStoppedCount", ConsolFun.AVERAGE);
    graphDef.datasource("lined", path, "taskStoppedFailCount", ConsolFun.AVERAGE);
    graphDef.area("linea", new Color(8, 175, 193), "Started");
    graphDef.stack("linec", new Color(133, 225, 224), "Stopped");
    graphDef.line("lineb", new Color(243, 165, 41), "Error Started", 2);
    graphDef.line("lined", new Color(241, 93, 5), "Error Stopped", 2);

    return createImage(graphDef);
}
 
开发者ID:chadmv,项目名称:plow,代码行数:19,代码来源:RrdGraphController.java

示例9: jobLaunchGraph

import org.rrd4j.ConsolFun; //导入依赖的package包/类
@ResponseBody
@RequestMapping(value="/monitor/graphs/job_launch.png", method=RequestMethod.GET, produces=MediaType.IMAGE_PNG_VALUE)
public byte[] jobLaunchGraph() throws IOException {

    final String path = rrdPath(PLOW_RRD);
    final RrdGraphDef graphDef = baseGraph("Job Launch", "jobs/sec");

    graphDef.datasource("linea", path, "jobLaunchCount", ConsolFun.AVERAGE);
    graphDef.datasource("lineb", path, "jobLaunchFailCount", ConsolFun.AVERAGE);
    graphDef.datasource("linec", path, "jobFinishCount", ConsolFun.AVERAGE);
    graphDef.datasource("lined", path, "jobKillCount", ConsolFun.AVERAGE);
    graphDef.area("linea", new Color(8, 175, 193), "Launched");
    graphDef.stack("linec", new Color(133, 225, 224), "Finished");
    graphDef.line("lineb", new Color(241, 93, 5), "Launch Fail", 2);
    graphDef.line("lined",  new Color(243, 165, 41), "Jobs Killed", 2);

    return createImage(graphDef);
}
 
开发者ID:chadmv,项目名称:plow,代码行数:19,代码来源:RrdGraphController.java

示例10: rndTrafficGraph

import org.rrd4j.ConsolFun; //导入依赖的package包/类
@ResponseBody
@RequestMapping(value="/monitor/graphs/rnd_traffic.png", method=RequestMethod.GET, produces=MediaType.IMAGE_PNG_VALUE)
public byte[] rndTrafficGraph() throws IOException {

    final String path = rrdPath(PLOW_RRD);
    final RrdGraphDef graphDef = baseGraph("Rnd Traffic", "ops/sec");

    graphDef.datasource("ping", path, "rndPingCount", ConsolFun.AVERAGE);
    graphDef.datasource("task", path, "rndTaskComplete", ConsolFun.AVERAGE);
    graphDef.area("ping", new Color(179, 96, 157), "Ping");
    graphDef.stack("task", new Color(255, 163, 231), "Task Complete");

    graphDef.comment("\\r");

    graphDef.gprint("ping", MAX, "Max Pings = %.3f%S");
    graphDef.gprint("ping", AVERAGE, "Avg Pings = %.3f%S\n");

    graphDef.gprint("task", MAX, "Max Task Complate = %.3f%s");
    graphDef.gprint("task", AVERAGE, "Avg Task Complete = %.3f%S\n");

    return createImage(graphDef);
}
 
开发者ID:chadmv,项目名称:plow,代码行数:23,代码来源:RrdGraphController.java

示例11: nodeDispatcherThreads

import org.rrd4j.ConsolFun; //导入依赖的package包/类
@ResponseBody
@RequestMapping(value="/monitor/graphs/node_threads.png", method=RequestMethod.GET, produces=MediaType.IMAGE_PNG_VALUE)
public byte[] nodeDispatcherThreads() throws IOException {

    final String path = rrdPath(THREAD_RRD);
    final RrdGraphDef graphDef = baseGraph("Node Dispatcher Queue", "threads/sec");

    graphDef.datasource("threads", path, "nodeActiveThreads", ConsolFun.AVERAGE);
    graphDef.datasource("queue", path, "nodeWaiting", ConsolFun.AVERAGE);

    graphDef.line("threads", new Color(152, 175, 54), "Active Threads");
    graphDef.area("queue", new Color(74, 104, 15), "Queued Work");

    graphDef.comment("\\r");

    graphDef.gprint("threads", MAX, "Max Threads = %.3f%S");
    graphDef.gprint("threads", AVERAGE, "Avg Threads = %.3f%S\n");

    graphDef.gprint("queue", MAX, "Max Queued = %.3f%s");
    graphDef.gprint("queue", AVERAGE, "Avg Queued = %.3f%S\n");

    return createImage(graphDef);
}
 
开发者ID:chadmv,项目名称:plow,代码行数:24,代码来源:RrdGraphController.java

示例12: printStatistics

import org.rrd4j.ConsolFun; //导入依赖的package包/类
public void printStatistics() {
    if(statSample != null) {
        try {
            long time = System.currentTimeMillis() / 1000;

            FetchRequest minRequest = statDB.createFetchRequest(ConsolFun.AVERAGE, time - 60  , time);
            FetchData minData = minRequest.fetchData();
            double triplesLastMin = minData.getAggregate("triples", ConsolFun.AVERAGE);

            FetchRequest hourRequest = statDB.createFetchRequest(ConsolFun.AVERAGE, time - (60 * 60) , time);
            FetchData hourData = hourRequest.fetchData();
            double triplesLastHour = hourData.getAggregate("triples", ConsolFun.AVERAGE);

            if(triplesLastMin != Double.NaN) {
                log.info("imported {} triples; statistics: {}/sec (last min), {}/sec (last hour)", UnitFormatter.formatSize(handler.triples), UnitFormatter.formatSize(triplesLastMin), UnitFormatter.formatSize(triplesLastHour));
            }
            previous = System.currentTimeMillis();

        } catch (IOException e) {
            log.warn("error updating statistics: {}", e.getMessage());
        }
    } else {
    }


}
 
开发者ID:apache,项目名称:marmotta,代码行数:27,代码来源:Statistics.java

示例13: run

import org.rrd4j.ConsolFun; //导入依赖的package包/类
@Override
public void run() {
    try {
        // generate PNG diagram
        RrdGraphDef gDef = new RrdGraphDef();
        gDef.setFilename("-");
        gDef.setWidth(800);
        gDef.setHeight(600);
        gDef.setStartTime(start / 1000);
        gDef.setEndTime(System.currentTimeMillis() / 1000);
        gDef.setTitle("KiWiLoader Performance");
        gDef.setVerticalLabel("number/sec");
        gDef.setAntiAliasing(true);


        gDef.datasource("triples", statFile.toString(), "triples", ConsolFun.AVERAGE);

        gDef.line("triples", Color.BLUE, "Triples Written", 3F);


        gDef.setImageFormat("png");
        gDef.gprint("triples", ConsolFun.AVERAGE, "average triples/sec: %,.0f\\l");

        RrdGraph graph = new RrdGraph(gDef);
        BufferedImage img = new BufferedImage(900,750, BufferedImage.TYPE_INT_RGB);
        graph.render(img.getGraphics());

        try (OutputStream stream = Files.newOutputStream(gFile, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE)) {
            ImageIO.write(img, "png", stream);
        }

        log.info("updated statistics diagram generated in {}", gFile);

        statLastDump = System.currentTimeMillis();
    } catch (Exception ex) {
        log.warn("error creating statistics diagram: {}", ex.getMessage());
    }
}
 
开发者ID:apache,项目名称:marmotta,代码行数:39,代码来源:Statistics.java

示例14: createMoodleGraph

import org.rrd4j.ConsolFun; //导入依赖的package包/类
private static final void createMoodleGraph(String graphLocation,
		String rrdDBLocation) {
	try {
		RrdGraphDef graphDef = new RrdGraphDef();
		graphDef.setTimeSpan(-3600L, -0L);
		graphDef.datasource("lineb", rrdDBLocation, "users", ConsolFun.TOTAL);
		graphDef.line("lineb", Color.GREEN, "Number of Moodle Users", 3);
		graphDef.setFilename(graphLocation);
		RrdGraph graph = new RrdGraph(graphDef);//actually creates the file.
	} catch (IOException e) {
		System.out.println(e);
	}
}
 
开发者ID:AdamHansrod,项目名称:Graphr,代码行数:14,代码来源:RRD.java

示例15: createSREventCountGraph

import org.rrd4j.ConsolFun; //导入依赖的package包/类
private static final void createSREventCountGraph(String graphLocation,
		String rrdDBLocation) {
	try {
		RrdGraphDef graphDef = new RrdGraphDef();
		graphDef.setTimeSpan(-3600L, -0L);
		graphDef.datasource("lineb", rrdDBLocation, "eventcount", ConsolFun.TOTAL);
		graphDef.line("lineb", Color.GREEN, "Event Count", 3);
		graphDef.setFilename(graphLocation);
		RrdGraph graph = new RrdGraph(graphDef);//actually creates the file.
	} catch (IOException e) {
		System.out.println(e);
	}
}
 
开发者ID:AdamHansrod,项目名称:Graphr,代码行数:14,代码来源:RRD.java


注:本文中的org.rrd4j.ConsolFun类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。