git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org
Subject: [JGIT PATCH 2/9] Remove dead stats code from WindowCache
Date: Wed, 11 Feb 2009 18:36:52 -0800	[thread overview]
Message-ID: <1234406219-19547-3-git-send-email-spearce@spearce.org> (raw)
In-Reply-To: <1234406219-19547-2-git-send-email-spearce@spearce.org>

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>
---
 .../src/org/spearce/jgit/lib/WindowCache.java      |   28 --------------------
 1 files changed, 0 insertions(+), 28 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java
index 0077f52..600ebdf 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java
+++ b/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,7 +191,6 @@ 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) {
@@ -223,7 +198,6 @@ public static synchronized final void get(final WindowCursor curs,
 				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;
-- 
1.6.2.rc0.204.gf6b427

  reply	other threads:[~2009-02-12  2:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-12  2:36 [JGIT PATCH 0/9] Misc. pack code cleanups Shawn O. Pearce
2009-02-12  2:36 ` [JGIT PATCH 1/9] Remove the Repository parameter from PackFile's constructor Shawn O. Pearce
2009-02-12  2:36   ` Shawn O. Pearce [this message]
2009-02-12  2:36     ` [JGIT PATCH 3/9] Document why WindowFile's hash is *31 Shawn O. Pearce
2009-02-12  2:36       ` [JGIT PATCH 4/9] Allow PackFile to lazily load its PackIndex on first demand Shawn O. Pearce
2009-02-12  2:36         ` [JGIT PATCH 5/9] Arrange pack files in recency order to improve quick hits Shawn O. Pearce
2009-02-12  2:36           ` [JGIT PATCH 6/9] Rename readPackHeader() to be onOpenPack() Shawn O. Pearce
2009-02-12  2:36             ` [JGIT PATCH 7/9] Validate the pack's footer checksum matches that in the index Shawn O. Pearce
2009-02-12  2:36               ` [JGIT PATCH 8/9] Remove yet another legacy StGit utility function Shawn O. Pearce
2009-02-12  2:36                 ` [JGIT PATCH 9/9] Make pack.indexversion config option default to version 2 Shawn O. Pearce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1234406219-19547-3-git-send-email-spearce@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).