public void generateGraph(long startTimestamp, long stopTimestamp, BufferedImage bufferedImage) throws Exception
{
File file = FileTools.newAkteraFile("/var/aktera/jvm-memory/" + name + ".rrd");
String fileName = file.getAbsolutePath();
RrdGraphDef gDef = new RrdGraphDef();
gDef.setWidth(1024);
gDef.setHeight(768);
gDef.setFilename(fileName + ".png");
gDef.setLazy(false);
gDef.setStartTime(startTimestamp);
gDef.setEndTime(stopTimestamp);
gDef.setTitle(name);
gDef.setVerticalLabel("Memory");
gDef.datasource("Init", fileName, "Init", AVERAGE);
gDef.datasource("Used", fileName, "Used", AVERAGE);
gDef.datasource("Committed", fileName, "Committed", AVERAGE);
gDef.datasource("Max", fileName, "Max", AVERAGE);
gDef.line("Init", Color.GREEN, "Init memory");
gDef.area("Max", Color.RED, "Max memory\n");
gDef.area("Committed", Color.gray, "Committed memory");
gDef.area("Used", Color.GREEN, "Used memory");
gDef.gprint("Used", MAX, "used-max = %.3f%s");
gDef.gprint("Committed", MAX, "committed-max = %.3f%S\\r");
gDef.gprint("Max", MAX, "max = %.3f%S");
gDef.gprint("Used", AVERAGE, "used-avg = %.3f%S\\r");
gDef.setImageInfo("<img src='%s' width='%d' height = '%d'>");
gDef.setPoolUsed(false);
gDef.setImageFormat("png");
gDef.setAltAutoscaleMax(true);
gDef.setAntiAliasing(true);
// create graph finally
RrdGraph graph = new RrdGraph(gDef);
graph.render(bufferedImage.getGraphics());