Browse Source

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>
stable-0.12
Shawn O. Pearce 14 years ago
parent
commit
7505b93546
  1. 27
      org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java

27
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java

@ -645,10 +645,12 @@ public class PackWriter {
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 @@ 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<ObjectToPack> sizeQueue = reader.getObjectSize(
Arrays.<ObjectToPack> 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

Loading…
Cancel
Save