]> source.dussan.org Git - jgit.git/commitdiff
PackWriter/Statistics: Report offloaded size 61/150861/3
authorIvan Frade <ifrade@google.com>
Wed, 9 Oct 2019 21:29:11 +0000 (14:29 -0700)
committerIvan Frade <ifrade@google.com>
Fri, 11 Oct 2019 21:13:24 +0000 (14:13 -0700)
Add to statistics the amount and size of packfiles offloaded to HTTP
download.

Change-Id: I895a7219ecac2794368bfc4fdfae74c1238deed9
Signed-off-by: Ivan Frade <ifrade@google.com>
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackStatistics.java

index 43067d364d796a6a8af074e285f9ddec2cb7325c..2f770e96fb95e097cbb4b387f895436aa14e31e8 100644 (file)
@@ -1230,6 +1230,8 @@ public class PackWriter implements AutoCloseable {
                                        if (packInfo != null) {
                                                o.writeString(packInfo.getHash() + ' ' +
                                                                packInfo.getUri() + '\n');
+                                               stats.offloadedPackfiles += 1;
+                                               stats.offloadedPackfileSize += packInfo.getSize();
                                        } else {
                                                unwrittenCachedPacks.add(pack);
                                        }
index e6e3d4fb12ad9f533bc74eda10e47840ab4f897d..645da0a068d2da6b18b3a3cc948f452c12e39ca3 100644 (file)
@@ -270,6 +270,20 @@ public class PackStatistics {
                 * @since 5.4*/
                public long treesTraversed;
 
+               /**
+                * Amount of packfile uris sent to the client to download via HTTP.
+                *
+                * @since 5.6
+                */
+               public long offloadedPackfiles;
+
+               /**
+                * Total size (in bytes) offloaded to HTTP downloads.
+                *
+                * @since 5.6
+                */
+               public long offloadedPackfileSize;
+
                /**
                 * Statistics about each object type in the pack (commits, tags, trees
                 * and blobs.)
@@ -597,6 +611,22 @@ public class PackStatistics {
                return statistics.treesTraversed;
        }
 
+       /**
+        * @return amount of packfiles offloaded (sent as "packfile-uri")/
+        * @since 5.6
+        */
+       public long getOffloadedPackfiles() {
+               return statistics.offloadedPackfiles;
+       }
+
+       /**
+        * @return total size (in bytes) offloaded to HTTP downloads.
+        * @since 5.6
+        */
+       public long getOffloadedPackfilesSize() {
+               return statistics.offloadedPackfileSize;
+       }
+
        /**
         * Get total time spent processing this pack.
         *