diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml deleted file mode 100644 index 07e0885..0000000 --- a/.idea/libraries/lib.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml deleted file mode 100644 index 07e0885..0000000 --- a/.idea/libraries/lib.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/lib1.xml b/.idea/libraries/lib1.xml new file mode 100644 index 0000000..8ce9ba1 --- /dev/null +++ b/.idea/libraries/lib1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml deleted file mode 100644 index 07e0885..0000000 --- a/.idea/libraries/lib.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/lib1.xml b/.idea/libraries/lib1.xml new file mode 100644 index 0000000..8ce9ba1 --- /dev/null +++ b/.idea/libraries/lib1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Simple-jdbc-statistics.iml b/Simple-jdbc-statistics.iml index ca90a9b..d61fca5 100644 --- a/Simple-jdbc-statistics.iml +++ b/Simple-jdbc-statistics.iml @@ -7,7 +7,7 @@ - + diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml deleted file mode 100644 index 07e0885..0000000 --- a/.idea/libraries/lib.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/lib1.xml b/.idea/libraries/lib1.xml new file mode 100644 index 0000000..8ce9ba1 --- /dev/null +++ b/.idea/libraries/lib1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Simple-jdbc-statistics.iml b/Simple-jdbc-statistics.iml index ca90a9b..d61fca5 100644 --- a/Simple-jdbc-statistics.iml +++ b/Simple-jdbc-statistics.iml @@ -7,7 +7,7 @@ - + diff --git a/src/nl/astraeus/jdbc/JdbcLogger.java b/src/nl/astraeus/jdbc/JdbcLogger.java index c409b54..0d222e2 100644 --- a/src/nl/astraeus/jdbc/JdbcLogger.java +++ b/src/nl/astraeus/jdbc/JdbcLogger.java @@ -5,7 +5,6 @@ import org.slf4j.LoggerFactory; import java.util.*; -import java.util.concurrent.ConcurrentHashMap; /** * User: riennentjes @@ -37,6 +36,17 @@ this.sql = sql; this.milli = milli; this.nano = nano; + this.count = 1; + } + + public LogEntry(LogEntry le) { + this.timeStamp = System.currentTimeMillis(); + this.hash = le.hash; + this.type = le.type; + this.sql = le .sql; + this.milli = le.milli; + this.nano = le.nano; + this.count = le.count; } public int getCount() { @@ -64,11 +74,11 @@ } public String getFormattedMilli() { - return Util.formatNano(milli*1000000); + return Util.formatNano(milli*1000000/count); } public String getFormattedNano() { - return Util.formatNano(nano); + return Util.formatNano(nano/count); } public String getTotal() { @@ -78,6 +88,13 @@ public String getSql() { return sql; } + + public void addCount(LogEntry le) { + count++; + this.milli += le.getMilli(); + this.nano += le.getNano(); + this.timeStamp = 0; + } } private final List queries; diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml deleted file mode 100644 index 07e0885..0000000 --- a/.idea/libraries/lib.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/lib1.xml b/.idea/libraries/lib1.xml new file mode 100644 index 0000000..8ce9ba1 --- /dev/null +++ b/.idea/libraries/lib1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Simple-jdbc-statistics.iml b/Simple-jdbc-statistics.iml index ca90a9b..d61fca5 100644 --- a/Simple-jdbc-statistics.iml +++ b/Simple-jdbc-statistics.iml @@ -7,7 +7,7 @@ - + diff --git a/src/nl/astraeus/jdbc/JdbcLogger.java b/src/nl/astraeus/jdbc/JdbcLogger.java index c409b54..0d222e2 100644 --- a/src/nl/astraeus/jdbc/JdbcLogger.java +++ b/src/nl/astraeus/jdbc/JdbcLogger.java @@ -5,7 +5,6 @@ import org.slf4j.LoggerFactory; import java.util.*; -import java.util.concurrent.ConcurrentHashMap; /** * User: riennentjes @@ -37,6 +36,17 @@ this.sql = sql; this.milli = milli; this.nano = nano; + this.count = 1; + } + + public LogEntry(LogEntry le) { + this.timeStamp = System.currentTimeMillis(); + this.hash = le.hash; + this.type = le.type; + this.sql = le .sql; + this.milli = le.milli; + this.nano = le.nano; + this.count = le.count; } public int getCount() { @@ -64,11 +74,11 @@ } public String getFormattedMilli() { - return Util.formatNano(milli*1000000); + return Util.formatNano(milli*1000000/count); } public String getFormattedNano() { - return Util.formatNano(nano); + return Util.formatNano(nano/count); } public String getTotal() { @@ -78,6 +88,13 @@ public String getSql() { return sql; } + + public void addCount(LogEntry le) { + count++; + this.milli += le.getMilli(); + this.nano += le.getNano(); + this.timeStamp = 0; + } } private final List queries; diff --git a/src/nl/astraeus/jdbc/util/Util.java b/src/nl/astraeus/jdbc/util/Util.java index eaa853b..44ce8c8 100644 --- a/src/nl/astraeus/jdbc/util/Util.java +++ b/src/nl/astraeus/jdbc/util/Util.java @@ -11,7 +11,7 @@ public class Util { // utility functions public static String formatNano(long l) { - NumberFormat format = new DecimalFormat("###,##0.000000"); + NumberFormat format = new DecimalFormat("###,##0.000"); return format.format((double) l / 1000000.0); } diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml deleted file mode 100644 index 07e0885..0000000 --- a/.idea/libraries/lib.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/lib1.xml b/.idea/libraries/lib1.xml new file mode 100644 index 0000000..8ce9ba1 --- /dev/null +++ b/.idea/libraries/lib1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Simple-jdbc-statistics.iml b/Simple-jdbc-statistics.iml index ca90a9b..d61fca5 100644 --- a/Simple-jdbc-statistics.iml +++ b/Simple-jdbc-statistics.iml @@ -7,7 +7,7 @@ - + diff --git a/src/nl/astraeus/jdbc/JdbcLogger.java b/src/nl/astraeus/jdbc/JdbcLogger.java index c409b54..0d222e2 100644 --- a/src/nl/astraeus/jdbc/JdbcLogger.java +++ b/src/nl/astraeus/jdbc/JdbcLogger.java @@ -5,7 +5,6 @@ import org.slf4j.LoggerFactory; import java.util.*; -import java.util.concurrent.ConcurrentHashMap; /** * User: riennentjes @@ -37,6 +36,17 @@ this.sql = sql; this.milli = milli; this.nano = nano; + this.count = 1; + } + + public LogEntry(LogEntry le) { + this.timeStamp = System.currentTimeMillis(); + this.hash = le.hash; + this.type = le.type; + this.sql = le .sql; + this.milli = le.milli; + this.nano = le.nano; + this.count = le.count; } public int getCount() { @@ -64,11 +74,11 @@ } public String getFormattedMilli() { - return Util.formatNano(milli*1000000); + return Util.formatNano(milli*1000000/count); } public String getFormattedNano() { - return Util.formatNano(nano); + return Util.formatNano(nano/count); } public String getTotal() { @@ -78,6 +88,13 @@ public String getSql() { return sql; } + + public void addCount(LogEntry le) { + count++; + this.milli += le.getMilli(); + this.nano += le.getNano(); + this.timeStamp = 0; + } } private final List queries; diff --git a/src/nl/astraeus/jdbc/util/Util.java b/src/nl/astraeus/jdbc/util/Util.java index eaa853b..44ce8c8 100644 --- a/src/nl/astraeus/jdbc/util/Util.java +++ b/src/nl/astraeus/jdbc/util/Util.java @@ -11,7 +11,7 @@ public class Util { // utility functions public static String formatNano(long l) { - NumberFormat format = new DecimalFormat("###,##0.000000"); + NumberFormat format = new DecimalFormat("###,##0.000"); return format.format((double) l / 1000000.0); } diff --git a/src/nl/astraeus/jdbc/web/page/QueryOverview.html b/src/nl/astraeus/jdbc/web/page/QueryOverview.html index 6c435c5..8c62971 100644 --- a/src/nl/astraeus/jdbc/web/page/QueryOverview.html +++ b/src/nl/astraeus/jdbc/web/page/QueryOverview.html @@ -1,9 +1,14 @@