From: Sasa M. <sa...@us...> - 2005-02-17 10:18:33
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31562/org/jrobin/core Modified Files: Datasource.java Log Message: Performance improvement (10%) for COUNTER datatype as suggested on http://www.jrobin.org/phpBB2/viewtopic.php?t=122 Index: Datasource.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/Datasource.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Datasource.java 9 Nov 2004 11:36:53 -0000 1.10 --- Datasource.java 17 Feb 2005 10:18:18 -0000 1.11 *************** *** 40,43 **** --- 40,46 ---- public class Datasource implements RrdUpdater, DsTypes { + private static final double MAX_32_BIT = Math.pow(2, 32); + private static final double MAX_64_BIT = Math.pow(2, 64); + private RrdDb parentDb; // definition *************** *** 224,234 **** if(!Double.isNaN(newValue) && !Double.isNaN(oldValue)) { double diff = newValue - oldValue; - double max32bit = Math.pow(2, 32); - double max64bit = Math.pow(2, 64); if(diff < 0) { ! diff += max32bit; } if(diff < 0) { ! diff += max64bit - max32bit; } if(diff >= 0) { --- 227,235 ---- if(!Double.isNaN(newValue) && !Double.isNaN(oldValue)) { double diff = newValue - oldValue; if(diff < 0) { ! diff += MAX_32_BIT; } if(diff < 0) { ! diff += MAX_64_BIT - MAX_32_BIT; } if(diff >= 0) { |