aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald Bhuleskar <funronald@google.com>2023-05-10 16:29:53 -0700
committerRonald Bhuleskar <funronald@google.com>2023-05-11 11:55:38 -0700
commitd0564cf8ae42e8f388a685dfcbcaeba0cec82db1 (patch)
treef516fde32b4b752ef3b705290d0367821fb49ef0
parente6f216119f2624db1e51f3414a3fec7dc3d67a2f (diff)
downloadjgit-d0564cf8ae42e8f388a685dfcbcaeba0cec82db1.tar.gz
jgit-d0564cf8ae42e8f388a685dfcbcaeba0cec82db1.zip
UploadPack: Record negotiation stats on fetchV2 call
ServiceV2 is not collecting wants/have in PackStatistics. This records the stats for fetch and push-negotiation. Change-Id: Iefd79f36b3d7837195e8bd9fc7007de352089e66
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
index f245eae39f..3264f556fa 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
@@ -1189,6 +1189,7 @@ public class UploadPack implements Closeable {
PackStatistics.Accumulator accumulator = new PackStatistics.Accumulator();
Instant negotiateStart = Instant.now();
+ accumulator.advertised = advertised.size();
ProtocolV2Parser parser = new ProtocolV2Parser(transferConfig);
FetchV2Request req = parser.parseFetchRequest(pckIn);
@@ -1209,6 +1210,7 @@ public class UploadPack implements Closeable {
// TODO(ifrade): Avoid mutating the parsed request.
req.getWantIds().addAll(wantedRefs.values());
wantIds = req.getWantIds();
+ accumulator.wants = wantIds.size();
boolean sectionSent = false;
boolean mayHaveShallow = req.getDepth() != 0
@@ -1766,7 +1768,6 @@ public class UploadPack implements Closeable {
&& line.length() == PACKET_HAVE.length() + 40) {
peerHas.add(ObjectId
.fromString(line.substring(PACKET_HAVE.length())));
- accumulator.haves++;
} else if (line.equals(PACKET_DONE)) {
last = processHaveLines(peerHas, last, pckOut, accumulator, Option.NONE);
@@ -1798,6 +1799,7 @@ public class UploadPack implements Closeable {
parseWants(accumulator);
if (peerHas.isEmpty())
return last;
+ accumulator.haves += peerHas.size();
sentReady = false;
int haveCnt = 0;