From 14a85d0de652d702b734c648a08d70eac0241807 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 25 Nov 2008 22:02:15 +0000 Subject: [PATCH] Differentiate between explicit queries and decomposed queries. --- src/java/com/samskivert/depot/Stats.java | 14 ++++++++++---- .../samskivert/depot/impl/FindAllKeysQuery.java | 2 +- .../com/samskivert/depot/impl/FindAllQuery.java | 15 +++++++-------- .../com/samskivert/depot/impl/FindOneQuery.java | 2 +- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/java/com/samskivert/depot/Stats.java b/src/java/com/samskivert/depot/Stats.java index 17550fa..1bbbb30 100644 --- a/src/java/com/samskivert/depot/Stats.java +++ b/src/java/com/samskivert/depot/Stats.java @@ -47,6 +47,9 @@ public class Stats /** The total number of collection queries that were loaded from the database. */ public final int uncachedQueries; + /** The total number of one-phase collection queries that executed. */ + public final int explicitQueries; + /** The number of record loads (individual or as part of a collection query) that were * loaded from the cache. */ public final long cachedRecords; @@ -69,7 +72,7 @@ public class Stats /** Creates a stats instance. */ protected Snapshot (int totalOps, long connectionWaitTime, - int cachedQueries, int uncachedQueries, + int cachedQueries, int uncachedQueries, int explicitQueries, int cachedRecords, int uncachedRecords, Histogram queryHisto, long queryTime, Histogram modifierHisto, long modifierTime) @@ -78,6 +81,7 @@ public class Stats this.connectionWaitTime = connectionWaitTime; this.cachedQueries = cachedQueries; this.uncachedQueries = uncachedQueries; + this.explicitQueries = explicitQueries; this.cachedRecords = cachedRecords; this.uncachedRecords = uncachedRecords; this.queryHisto = queryHisto; @@ -90,7 +94,8 @@ public class Stats public synchronized Snapshot getSnapshot () { return new Snapshot(_totalOps, _connectionWaitTime, - _cachedQueries, _uncachedQueries, _cachedRecords, _uncachedRecords, + _cachedQueries, _uncachedQueries, _explicitQueries, + _cachedRecords, _uncachedRecords, _readHisto.clone(), _readTime, _writeHisto.clone(), _writeTime); } @@ -115,11 +120,12 @@ public class Stats } } - public synchronized void noteQuery (int cachedQueries, int uncachedQueries, + public synchronized void noteQuery (int cachedQueries, int uncachedQueries, int explicitQueries, int cachedRecords, int uncachedRecords) { _cachedQueries += cachedQueries; _uncachedQueries += uncachedQueries; + _explicitQueries += explicitQueries; _cachedRecords += cachedRecords; _uncachedRecords += uncachedRecords; } @@ -133,6 +139,6 @@ public class Stats protected Histogram _writeHisto = new Histogram(0, 500, 20); protected long _writeTime; - protected int _cachedQueries, _uncachedQueries; + protected int _cachedQueries, _uncachedQueries, _explicitQueries; protected int _cachedRecords, _uncachedRecords; } diff --git a/src/java/com/samskivert/depot/impl/FindAllKeysQuery.java b/src/java/com/samskivert/depot/impl/FindAllKeysQuery.java index 53c9c1e..3d7caf9 100644 --- a/src/java/com/samskivert/depot/impl/FindAllKeysQuery.java +++ b/src/java/com/samskivert/depot/impl/FindAllKeysQuery.java @@ -95,7 +95,7 @@ public class FindAllKeysQuery extends Query extends Query _select; @@ -235,7 +232,8 @@ public abstract class FindAllQuery extends Query type) @@ -365,5 +363,6 @@ public abstract class FindAllQuery extends Query _type; protected DepotMarshaller _marsh; - protected int _cachedQueries, _uncachedQueries, _cachedRecords, _uncachedRecords; + protected int _cachedQueries, _uncachedQueries, _explicitQueries; + protected int _cachedRecords, _uncachedRecords; } diff --git a/src/java/com/samskivert/depot/impl/FindOneQuery.java b/src/java/com/samskivert/depot/impl/FindOneQuery.java index ea4d289..a61e8e2 100644 --- a/src/java/com/samskivert/depot/impl/FindOneQuery.java +++ b/src/java/com/samskivert/depot/impl/FindOneQuery.java @@ -118,7 +118,7 @@ public class FindOneQuery extends Query // from Operation public void updateStats (Stats stats) { - stats.noteQuery(0, 0, _cachedRecords, 1-_cachedRecords); + stats.noteQuery(0, 0, 0, _cachedRecords, 1-_cachedRecords); } protected CacheKey getCacheKey ()