From 7505b93546376d3d46976e3a81ea791ba6a265ce Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 22 Feb 2011 18:56:51 -0800 Subject: [PATCH] PackWriter: Add missing timers to Statistics We did not record the time spent on the object reuse search or the object size lookup, both of which occur between the counting phase and the compressing phase. If there are enough objects involved, these times can be significant so its worth timing them and recording it. Change-Id: I89084acfc598bb6533d75d90cb8de459f0ed93be Signed-off-by: Shawn O. Pearce --- .../eclipse/jgit/storage/pack/PackWriter.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) 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 46c412b94e..ee7ffae010 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 @@ -645,10 +645,12 @@ public class PackWriter { int cnt = 0; for (List list : objectsLists) cnt += list.size(); + long start = System.currentTimeMillis(); monitor.beginTask(JGitText.get().searchForReuse, cnt); for (List list : objectsLists) reuseSupport.selectObjectRepresentation(this, monitor, list); monitor.endTask(); + stats.timeSearchingForReuse = System.currentTimeMillis() - start; } private void searchForDeltas(ProgressMonitor monitor) @@ -685,6 +687,7 @@ public class PackWriter { // search code to discover the missing object and skip over it, or // abort with an exception if we actually had to have it. // + final long sizingStart = System.currentTimeMillis(); monitor.beginTask(JGitText.get().searchForSizes, cnt); AsyncObjectSizeQueue sizeQueue = reader.getObjectSize( Arrays. asList(list).subList(0, cnt), false); @@ -731,6 +734,7 @@ public class PackWriter { sizeQueue.release(); } monitor.endTask(); + stats.timeSearchingForSizes = System.currentTimeMillis() - sizingStart; // Sort the objects by path hash so like files are near each other, // and then by size descending so that bigger files are first. This @@ -1531,6 +1535,10 @@ public class PackWriter { long timeCounting; + long timeSearchingForReuse; + + long timeSearchingForSizes; + long timeCompressing; long timeWriting; @@ -1641,6 +1649,25 @@ public class PackWriter { return timeCounting; } + /** + * @return time in milliseconds spent matching existing representations + * against objects that will be transmitted, or that the client + * can be assumed to already have. + */ + public long getTimeSearchingForReuse() { + return timeSearchingForReuse; + } + + /** + * @return time in milliseconds spent finding the sizes of all objects + * that will enter the delta compression search window. The + * sizes need to be known to better match similar objects + * together and improve delta compression ratios. + */ + public long getTimeSearchingForSizes() { + return timeSearchingForSizes; + } + /** * @return time in milliseconds spent on delta compression. This is * observed wall-clock time and does not accurately track CPU -- 2.39.5