diff options
author | Alexa Panfil <alexapizza@google.com> | 2020-09-11 09:34:23 +0000 |
---|---|---|
committer | Alexa Panfil <alexapizza@google.com> | 2020-09-22 10:05:03 +0000 |
commit | c3458a6e03707c0e45cd6354d1e6f0aebadf234e (patch) | |
tree | d715ee593281fbf7a53f179d3d73808f7c89f8b8 /org.eclipse.jgit | |
parent | 292919b12a1e2f0584edbfb630a2b67567d4d9be (diff) | |
download | jgit-c3458a6e03707c0e45cd6354d1e6f0aebadf234e.tar.gz jgit-c3458a6e03707c0e45cd6354d1e6f0aebadf234e.zip |
Measure time taken for negotiation in protocol V2
Reason why this change is needed:
Getting this metric will help estimate how much time is spent
on negotiation in fetch V2.
What this patch does:
Measure time spent on negotiation rounds in UploadPack.fetchV2()
and save it in an instance of PackStatistics.Accumulator.
This is the same way the statistics are already gathered for
protocol V0/V1.
Change-Id: I14e55dd6ff743cb0b21b4953b533269ef069abb1
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java | 9 |
1 files changed, 8 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 9889015261..8c243d439b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -1137,6 +1137,9 @@ public class UploadPack { advertised = refIdSet(getAdvertisedOrDefaultRefs().values()); } + PackStatistics.Accumulator accumulator = new PackStatistics.Accumulator(); + long negotiateStart = System.currentTimeMillis(); + ProtocolV2Parser parser = new ProtocolV2Parser(transferConfig); FetchV2Request req = parser.parseFetchRequest(pckIn); currentRequest = req; @@ -1238,7 +1241,11 @@ public class UploadPack { // But sideband-all is not used, so we have to write it ourselves. pckOut.writeString("packfile\n"); //$NON-NLS-1$ } - sendPack(new PackStatistics.Accumulator(), + + accumulator.timeNegotiating = System.currentTimeMillis() + - negotiateStart; + + sendPack(accumulator, req, req.getClientCapabilities().contains(OPTION_INCLUDE_TAG) ? db.getRefDatabase().getRefsByPrefix(R_TAGS) |