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 <spearce@spearce.org>
This commit is contained in:
Shawn O. Pearce 2011-02-22 18:56:51 -08:00
parent 5f3d577e5a
commit 7505b93546
1 changed files with 27 additions and 0 deletions

View File

@ -645,10 +645,12 @@ private void searchForReuse(ProgressMonitor monitor) throws IOException {
int cnt = 0;
for (List<ObjectToPack> list : objectsLists)
cnt += list.size();
long start = System.currentTimeMillis();
monitor.beginTask(JGitText.get().searchForReuse, cnt);
for (List<ObjectToPack> list : objectsLists)
reuseSupport.selectObjectRepresentation(this, monitor, list);
monitor.endTask();
stats.timeSearchingForReuse = System.currentTimeMillis() - start;
}
private void searchForDeltas(ProgressMonitor monitor)
@ -685,6 +687,7 @@ private void searchForDeltas(ProgressMonitor monitor)
// 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<ObjectToPack> sizeQueue = reader.getObjectSize(
Arrays.<ObjectToPack> asList(list).subList(0, cnt), false);
@ -731,6 +734,7 @@ else if (sz <= DeltaIndex.BLKSZ)
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 static class Statistics {
long timeCounting;
long timeSearchingForReuse;
long timeSearchingForSizes;
long timeCompressing;
long timeWriting;
@ -1641,6 +1649,25 @@ public long getTimeCounting() {
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