aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Winkler2012-01-23 05:09:51 -0500
committerStefan Winkler2012-01-23 05:09:51 -0500
commitf85b87a594f305e9af59c514163c38432731a667 (patch)
treeedff349d4ac4bb0a1de9fed79b34350ea1e48740
parented56b1db68e515861afb0afce574106f7191bb04 (diff)
downloadcdo-bugs/369364.tar.gz
cdo-bugs/369364.tar.xz
cdo-bugs/369364.zip
[369364] [DB4O] Performance reports should be logged via a Tracer, notbugs/369364
via OM.LOG https://bugs.eclipse.org/bugs/show_bug.cgi?id=369364
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/internal/db4o/DB4OStoreAccessor.java45
1 files changed, 36 insertions, 9 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/internal/db4o/DB4OStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/internal/db4o/DB4OStoreAccessor.java
index 1d30927442..3ffda8ba5b 100644
--- a/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/internal/db4o/DB4OStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.db4o/src/org/eclipse/emf/cdo/server/internal/db4o/DB4OStoreAccessor.java
@@ -54,6 +54,7 @@ import org.eclipse.net4j.util.io.IOUtil;
import org.eclipse.net4j.util.om.monitor.Monitor;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
import org.eclipse.net4j.util.om.monitor.OMMonitor.Async;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
@@ -90,6 +91,8 @@ import java.util.Set;
*/
public class DB4OStoreAccessor extends LongIDStoreAccessor implements Raw, DurableLocking
{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DB4OStoreAccessor.class);
+
private ObjectContainer objectContainer;
public DB4OStoreAccessor(DB4OStore store, ISession session)
@@ -598,10 +601,18 @@ public class DB4OStoreAccessor extends LongIDStoreAccessor implements Raw, Durab
try
{
- long start = System.currentTimeMillis();
+ long start = 0;
+ if (TRACER.isEnabled())
+ {
+ start = System.currentTimeMillis();
+ }
getObjectContainer().commit();
- long end = System.currentTimeMillis();
- OM.LOG.debug("Commit took -> " + (end - start) + " milliseconds");
+
+ if (TRACER.isEnabled())
+ {
+ long end = System.currentTimeMillis();
+ TRACER.format("Commit took: {0} milliseconds.", end - start);
+ }
}
catch (Exception e)
{
@@ -629,13 +640,22 @@ public class DB4OStoreAccessor extends LongIDStoreAccessor implements Raw, Durab
try
{
- long start = System.currentTimeMillis();
+ long start = 0;
+ if (TRACER.isEnabled())
+ {
+ start = System.currentTimeMillis();
+ }
+
for (InternalCDORevision revision : revisions)
{
writeRevision(revision, monitor.fork());
}
- long end = System.currentTimeMillis();
- OM.LOG.debug("Storage of " + revisions.length + " revisions took: " + (end - start) + " milliseconds");
+
+ if (TRACER.isEnabled())
+ {
+ long end = System.currentTimeMillis();
+ TRACER.format("Storage of {0} revisions took: {1} milliseconds.", revisions.length, end - start);
+ }
}
finally
{
@@ -668,13 +688,20 @@ public class DB4OStoreAccessor extends LongIDStoreAccessor implements Raw, Durab
// TODO removal of previous version implies query, this should be optimized
- long start = System.currentTimeMillis();
+ long start = 0;
+ if (TRACER.isEnabled())
+ {
+ start = System.currentTimeMillis();
+ }
CDOID id = revision.getID();
DB4OStore.removeRevision(getObjectContainer(), id);
DB4ORevision primitiveRevision = DB4ORevision.getDB4ORevision(revision);
writeObject(primitiveRevision, monitor);
- long end = System.currentTimeMillis();
- OM.LOG.debug("Writing revision " + id + " took: " + (end - start) + " milliseconds");
+ if (TRACER.isEnabled())
+ {
+ long end = System.currentTimeMillis();
+ TRACER.format("Writing revision {0} took: {1} milliseconds.", id, end - start);
+ }
}
finally
{