summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2011-08-15 16:38:28 -0700
committerShawn O. Pearce <spearce@spearce.org>2011-09-14 15:34:55 -0700
commit1b6a549ff350673402f797fe7f878175e2b5ba30 (patch)
tree2f7ac0f27ff64a7afb73b06c928ea418b9e958d2
parent38b3816d65bda75f3431d518dc76ac3d09371dfe (diff)
downloadjgit-1b6a549ff350673402f797fe7f878175e2b5ba30.tar.gz
jgit-1b6a549ff350673402f797fe7f878175e2b5ba30.zip
PackWriter: Export more statistics
Export the shallow pack information, and also a handy function to sum up the total times. Include the time writing out the index file, if it was created. Change-Id: I7f60ae6848455a357b25feedb23743bbf6c153cf Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java
index 0e34554395..ab40831823 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java
@@ -714,6 +714,7 @@ public class PackWriter {
if (!cachedPacks.isEmpty())
throw new IOException(JGitText.get().cachedPacksPreventsIndexCreation);
+ long writeStart = System.currentTimeMillis();
final List<ObjectToPack> list = sortByName();
final PackIndexWriter iw;
int indexVersion = config.getIndexVersion();
@@ -722,6 +723,7 @@ public class PackWriter {
else
iw = PackIndexWriter.createVersion(indexStream, indexVersion);
iw.write(list, packcsum);
+ stats.timeWriting += System.currentTimeMillis() - writeStart;
}
private List<ObjectToPack> sortByName() {
@@ -828,6 +830,7 @@ public class PackWriter {
stats.timeWriting = System.currentTimeMillis() - writeStart;
stats.totalBytes = out.length();
stats.reusedPacks = Collections.unmodifiableList(cachedPacks);
+ stats.depth = depth;
for (Statistics.ObjectType typeStat : stats.objectTypes) {
if (typeStat == null)
@@ -1870,6 +1873,8 @@ public class PackWriter {
Collection<CachedPack> reusedPacks;
+ int depth;
+
int deltaSearchNonEdgeObjects;
int deltasFound;
@@ -2012,6 +2017,16 @@ public class PackWriter {
return objectTypes[typeCode];
}
+ /** @return true if the resulting pack file was a shallow pack. */
+ public boolean isShallow() {
+ return depth > 0;
+ }
+
+ /** @return depth (in commits) the pack includes if shallow. */
+ public int getDepth() {
+ return depth;
+ }
+
/**
* @return time in milliseconds spent enumerating the objects that need
* to be included in the output. This time includes any restarts
@@ -2060,6 +2075,15 @@ public class PackWriter {
return timeWriting;
}
+ /** @return total time spent processing this pack. */
+ public long getTimeTotal() {
+ return timeCounting
+ + timeSearchingForReuse
+ + timeSearchingForSizes
+ + timeCompressing
+ + timeWriting;
+ }
+
/**
* @return get the average output speed in terms of bytes-per-second.
* {@code getTotalBytes() / (getTimeWriting() / 1000.0)}.