Permalink
Browse files

Remove dead stats code from WindowCache

I used this code to try and tune the WindowCache a bit, but we're
about as good as we can do for now.  There's no point in keeping
it all around in somewhat critical paths if we never use it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
  • Loading branch information...
1 parent a1f6d5d commit a0c15aa99018c3548893c695ea79cd58ad18af8e @spearce spearce committed with robinrosenberg Feb 12, 2009
Showing with 0 additions and 28 deletions.
  1. +0 −28 org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java
@@ -76,14 +76,6 @@ private static final int bits(int newSize) {
private static int openByteCount;
- private static int hits;
-
- private static int reqs;
-
- private static int opens;
-
- private static int closes;
-
static {
maxByteCount = 10 * MB;
windowSizeShift = bits(8 * KB);
@@ -93,22 +85,6 @@ private static final int bits(int newSize) {
clearedWindowQueue = new ReferenceQueue<Object>();
}
- static synchronized String statString() {
- int maxChain = 0, tot = 0;
- for (ByteWindow<?> e : cache) {
- int n = 0;
- for (; e != null; e = e.chainNext) {
- n++;
- tot++;
- }
- maxChain = Math.max(maxChain, n);
- }
- return "WindowCache[ hits: " + (hits * 100 / reqs) + "%"
- + "; windows: " + tot + " maxChain: " + maxChain + "; kb:"
- + (openByteCount / KB) + "; cache: " + cache.length + " fds: "
- + (opens - closes) + "," + opens + "," + closes + " ]";
- }
-
private static int cacheTableSize() {
return 5 * (maxByteCount / windowSize) / 2;
}
@@ -215,15 +191,13 @@ private static synchronized void reconfigureImpl(final int packedGitLimit,
*/
public static synchronized final void get(final WindowCursor curs,
final WindowedFile wp, final long position) throws IOException {
- reqs++;
final int id = (int) (position >> windowSizeShift);
final int idx = hash(wp, id);
for (ByteWindow<?> e = cache[idx]; e != null; e = e.chainNext) {
if (e.provider == wp && e.id == id) {
if ((curs.handle = e.get()) != null) {
curs.window = e;
makeMostRecent(e);
- hits++;
return;
}
@@ -234,7 +208,6 @@ public static synchronized final void get(final WindowCursor curs,
if (wp.openCount == 0) {
try {
- opens++;
wp.openCount = 1;
wp.cacheOpen();
} catch (IOException ioe) {
@@ -340,7 +313,6 @@ private static void clear(final ByteWindow<?> e) {
private static void unlinkSize(final ByteWindow<?> e) {
if (e.sizeActive) {
if (--e.provider.openCount == 0) {
- closes++;
e.provider.cacheClose();
}
openByteCount -= e.size;

0 comments on commit a0c15aa

Please sign in to comment.