Add debug trace to measure time needed to open pack index
Change-Id: Ia698cc06aa3fe6cb7903a687db8885f1b83c3bf2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
9a7d3b053a
commit
b5c594216b
|
@ -93,6 +93,8 @@
|
||||||
import org.eclipse.jgit.util.LongList;
|
import org.eclipse.jgit.util.LongList;
|
||||||
import org.eclipse.jgit.util.NB;
|
import org.eclipse.jgit.util.NB;
|
||||||
import org.eclipse.jgit.util.RawParseUtils;
|
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
|
* A Git version 2 pack file representation. A pack file contains Git objects in
|
||||||
|
@ -100,6 +102,7 @@
|
||||||
* objects are similar.
|
* objects are similar.
|
||||||
*/
|
*/
|
||||||
public class PackFile implements Iterable<PackIndex.MutableEntry> {
|
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. */
|
/** Sorts PackFiles to be most recently created to least recently created. */
|
||||||
public static final Comparator<PackFile> SORT = new Comparator<PackFile>() {
|
public static final Comparator<PackFile> SORT = new Comparator<PackFile>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -189,7 +192,17 @@ private PackIndex idx() throws IOException {
|
||||||
throw new PackInvalidException(packFile, invalidatingCause);
|
throw new PackInvalidException(packFile, invalidatingCause);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
idx = PackIndex.open(extFile(INDEX));
|
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) {
|
if (packChecksum == null) {
|
||||||
packChecksum = idx.packChecksum;
|
packChecksum = idx.packChecksum;
|
||||||
|
|
Loading…
Reference in New Issue