Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2019-06-04 13:46:44 +0000
committerMatthias Sohn2019-06-04 16:15:17 +0000
commitb5c594216ba1a462796e5e4d8d929062db143768 (patch)
tree51e2e511c4b0861204cd3cb026428267c9ab6530
parent9a7d3b053a3f28af5983539a860729066cae524c (diff)
downloadjgit-b5c594216ba1a462796e5e4d8d929062db143768.tar.gz
jgit-b5c594216ba1a462796e5e4d8d929062db143768.tar.xz
jgit-b5c594216ba1a462796e5e4d8d929062db143768.zip
Add debug trace to measure time needed to open pack index
Change-Id: Ia698cc06aa3fe6cb7903a687db8885f1b83c3bf2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
index 7313305c9e..73ad38c95a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
@@ -93,6 +93,8 @@ import org.eclipse.jgit.lib.ObjectLoader;
import org.eclipse.jgit.util.LongList;
import org.eclipse.jgit.util.NB;
import org.eclipse.jgit.util.RawParseUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A Git version 2 pack file representation. A pack file contains Git objects in
@@ -100,6 +102,7 @@ import org.eclipse.jgit.util.RawParseUtils;
* objects are similar.
*/
public class PackFile implements Iterable<PackIndex.MutableEntry> {
+ private final static Logger LOG = LoggerFactory.getLogger(PackFile.class);
/** Sorts PackFiles to be most recently created to least recently created. */
public static final Comparator<PackFile> SORT = new Comparator<PackFile>() {
@Override
@@ -189,7 +192,17 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
throw new PackInvalidException(packFile, invalidatingCause);
}
try {
+ long start = System.currentTimeMillis();
idx = PackIndex.open(extFile(INDEX));
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(String.format(
+ "Opening pack index %s, size %.3f MB took %d ms", //$NON-NLS-1$
+ extFile(INDEX).getAbsolutePath(),
+ Float.valueOf(extFile(INDEX).length()
+ / (1024f * 1024)),
+ Long.valueOf(System.currentTimeMillis()
+ - start)));
+ }
if (packChecksum == null) {
packChecksum = idx.packChecksum;

Back to the top