|
From: Sasa M. <sa...@us...> - 2004-03-29 14:49:57
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4289/org/jrobin/core Modified Files: RrdDouble.java RrdInt.java RrdLong.java RrdPrimitive.java RrdString.java Log Message: Squeeze the lemon. StressTest cut from 1hr to 40mins, Demo cut from 20sec to 16sec. Index: RrdString.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdString.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RrdString.java 27 Nov 2003 10:22:58 -0000 1.4 --- RrdString.java 29 Mar 2004 14:38:28 -0000 1.5 *************** *** 47,50 **** --- 47,51 ---- } cache = new String(c).trim(); + cached = true; } } *************** *** 56,73 **** void set(String value) throws IOException { ! cache = value.trim(); ! RrdFile rrdFile = getRrdFile(); ! rrdFile.seek(getPointer()); ! for(int i = 0; i < SIZE; i++) { ! if(i < cache.length()) { ! rrdFile.writeChar(cache.charAt(i)); ! } ! else { ! rrdFile.writeChar(' '); } } } String get() { return cache; } --- 57,79 ---- void set(String value) throws IOException { ! value = value.trim(); ! if(!cached || !cache.equals(value)) { ! RrdFile rrdFile = getRrdFile(); ! rrdFile.seek(getPointer()); ! for(int i = 0; i < SIZE; i++) { ! if(i < value.length()) { ! rrdFile.writeChar(value.charAt(i)); ! } ! else { ! rrdFile.writeChar(' '); ! } } + cache = value; + cached = true; } } String get() { + assert cached: "Not cached!"; return cache; } Index: RrdInt.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdInt.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RrdInt.java 27 Nov 2003 10:22:58 -0000 1.4 --- RrdInt.java 29 Mar 2004 14:38:28 -0000 1.5 *************** *** 43,46 **** --- 43,47 ---- rrdFile.seek(getPointer()); cache = rrdFile.readInt(); + cached = true; } } *************** *** 52,62 **** void set(int value) throws IOException { ! cache = value; ! RrdFile rrdFile = getRrdFile(); ! rrdFile.seek(getPointer()); ! rrdFile.writeInt(cache); } int get() { return cache; } --- 53,67 ---- void set(int value) throws IOException { ! if(!cached || cache != value) { ! RrdFile rrdFile = getRrdFile(); ! rrdFile.seek(getPointer()); ! rrdFile.writeInt(value); ! cache = value; ! cached = true; ! } } int get() { + assert cached: "Not cached!"; return cache; } Index: RrdLong.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdLong.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RrdLong.java 27 Nov 2003 10:22:58 -0000 1.4 --- RrdLong.java 29 Mar 2004 14:38:28 -0000 1.5 *************** *** 43,46 **** --- 43,47 ---- rrdFile.seek(getPointer()); cache = rrdFile.readLong(); + cached = true; } } *************** *** 52,62 **** void set(long value) throws IOException { ! cache = value; ! RrdFile rrdFile = getRrdFile(); ! rrdFile.seek(getPointer()); ! rrdFile.writeLong(cache); } long get() { return cache; } --- 53,67 ---- void set(long value) throws IOException { ! if(!cached || cache != value) { ! RrdFile rrdFile = getRrdFile(); ! rrdFile.seek(getPointer()); ! rrdFile.writeLong(value); ! cache = value; ! cached = true; ! } } long get() { + assert cached: "Not cached!"; return cache; } Index: RrdDouble.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdDouble.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RrdDouble.java 27 Nov 2003 10:22:58 -0000 1.4 --- RrdDouble.java 29 Mar 2004 14:38:28 -0000 1.5 *************** *** 43,46 **** --- 43,47 ---- rrdFile.seek(getPointer()); cache = rrdFile.readDouble(); + cached = true; } } *************** *** 52,62 **** void set(double value) throws IOException { ! cache = value; ! RrdFile rrdFile = getRrdFile(); ! rrdFile.seek(getPointer()); ! rrdFile.writeDouble(cache); } double get() { return cache; } --- 53,67 ---- void set(double value) throws IOException { ! if(!cached || cache != value) { ! RrdFile rrdFile = getRrdFile(); ! rrdFile.seek(getPointer()); ! rrdFile.writeDouble(value); ! cache = value; ! cached = true; ! } } double get() { + assert cached: "Not cached!"; return cache; } Index: RrdPrimitive.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdPrimitive.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RrdPrimitive.java 27 Nov 2003 14:15:11 -0000 1.3 --- RrdPrimitive.java 29 Mar 2004 14:38:28 -0000 1.4 *************** *** 32,36 **** private long pointer; private int byteCount; ! RrdPrimitive(RrdUpdater parent, int byteCount) throws IOException { this.parent = parent; --- 32,38 ---- private long pointer; private int byteCount; ! ! protected boolean cached = false; ! RrdPrimitive(RrdUpdater parent, int byteCount) throws IOException { this.parent = parent; |