From: Sasa M. <sa...@us...> - 2004-05-30 10:06:57
|
Update of /cvsroot/jrobin/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23240 Modified Files: Demo.java StressTest.java Log Message: greatly improved RrdNioBackend. By default RrdNioBackend is flushed to the disc every 60 seconds from a separate thread. Index: Demo.java =================================================================== RCS file: /cvsroot/jrobin/src/Demo.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Demo.java 20 May 2004 10:29:31 -0000 1.17 --- Demo.java 30 May 2004 10:06:46 -0000 1.18 *************** *** 36,51 **** class Demo { ! static final long SEED = 1909752002L; ! static final Random RANDOM = new Random(SEED); static final String FILE = "demo"; - static final String FACTORY_NAME = "FILE"; static final long START = Util.getTimestamp(2003, 4, 1); static final long END = Util.getTimestamp(2003, 5, 1); - static final int MAX_STEP = 300; public static void main(String[] args) throws RrdException, IOException { // setup println("== Starting demo"); --- 36,51 ---- class Demo { ! static final String FACTORY_NAME = "FILE"; ! ! static final long SEED = 1909752002L; static final Random RANDOM = new Random(SEED); static final String FILE = "demo"; static final long START = Util.getTimestamp(2003, 4, 1); static final long END = Util.getTimestamp(2003, 5, 1); static final int MAX_STEP = 300; public static void main(String[] args) throws RrdException, IOException { + RrdDb.setDefaultFactory(FACTORY_NAME); // setup println("== Starting demo"); Index: StressTest.java =================================================================== RCS file: /cvsroot/jrobin/src/StressTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** StressTest.java 24 May 2004 15:02:28 -0000 1.4 --- StressTest.java 30 May 2004 10:06:47 -0000 1.5 *************** *** 35,55 **** class StressTest { ! public static final String RRD_BACKEND_FACTORY = "NIO"; ! public static final String RRD_PATH = Util.getJRobinDemoPath("stress.rrd"); ! public static final long RRD_START = 946710000L; ! public static final long RRD_STEP = 30; ! public static final String RRD_DATASOURCE_NAME = "T"; ! public static final int RRD_DATASOURCE_COUNT = 6; ! public static final long TIME_START = 1060142010L; ! public static final long TIME_END = 1080013472L; ! public static final String PNG_PATH = Util.getJRobinDemoPath("stress.png"); ! public static final int PNG_WIDTH = 400; ! public static final int PNG_HEIGHT = 250; ! public static void printLapTime(String message) { System.out.println(message + " " + Util.getLapTime()); } --- 35,55 ---- class StressTest { ! static final String FACTORY_NAME = "NIO"; ! static final String RRD_PATH = Util.getJRobinDemoPath("stress.rrd"); ! static final long RRD_START = 946710000L; ! static final long RRD_STEP = 30; ! static final String RRD_DATASOURCE_NAME = "T"; ! static final int RRD_DATASOURCE_COUNT = 6; ! static final long TIME_START = 1060142010L; ! static final long TIME_END = 1080013472L; ! static final String PNG_PATH = Util.getJRobinDemoPath("stress.png"); ! static final int PNG_WIDTH = 400; ! static final int PNG_HEIGHT = 250; ! static void printLapTime(String message) { System.out.println(message + " " + Util.getLapTime()); } *************** *** 75,80 **** System.out.println("********************************************************************"); printLapTime("Starting demo at " + new Date()); ! RrdBackendFactory.setDefaultFactory(RRD_BACKEND_FACTORY); ! printLapTime("Backend factory set to " + RRD_BACKEND_FACTORY); // create RRD database printLapTime("Creating RRD definition"); --- 75,80 ---- System.out.println("********************************************************************"); printLapTime("Starting demo at " + new Date()); ! RrdDb.setDefaultFactory(FACTORY_NAME); ! printLapTime("Backend factory set to " + FACTORY_NAME); // create RRD database printLapTime("Creating RRD definition"); *************** *** 98,102 **** def.addArchive("MAX", 0.5, 1440, 50000); printLapTime("Definition created, creating RRD file"); ! RrdDb rrd = new RrdDb(def); printLapTime("RRD file created: " + RRD_PATH); BufferedReader r = new BufferedReader(new FileReader(args[0])); --- 98,102 ---- def.addArchive("MAX", 0.5, 1440, 50000); printLapTime("Definition created, creating RRD file"); ! RrdDb rrd = RrdDbPool.getInstance().requestRrdDb(def); printLapTime("RRD file created: " + RRD_PATH); BufferedReader r = new BufferedReader(new FileReader(args[0])); *************** *** 140,144 **** gdef.comment("\nOriginal data provided by diy-zoning.sf.net@c"); printLapTime("Graph definition created"); ! RrdGraph g = new RrdGraph(gdef); g.saveAsPNG(PNG_PATH, PNG_WIDTH, PNG_HEIGHT); printLapTime("Graph saved: " + PNG_PATH); --- 140,144 ---- gdef.comment("\nOriginal data provided by diy-zoning.sf.net@c"); printLapTime("Graph definition created"); ! RrdGraph g = new RrdGraph(gdef, true); g.saveAsPNG(PNG_PATH, PNG_WIDTH, PNG_HEIGHT); printLapTime("Graph saved: " + PNG_PATH); |