]> source.dussan.org Git - jgit.git/commitdiff
Track object inflation time in DfsReaderIoStats 06/138206/2
authorTerry Parker <tparker@google.com>
Wed, 6 Mar 2019 18:01:16 +0000 (10:01 -0800)
committerTerry Parker <tparker@google.com>
Wed, 6 Mar 2019 18:54:52 +0000 (10:54 -0800)
This can help track down poor long tail performance that isn't accounted
for in the readIdxMicros or readBlockMicros metrics.

Change-Id: I701b9cfcc124f4ddb860d1766a11ea3557e604ce
Signed-off-by: Terry Parker <tparker@google.com>
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReaderIoStats.java

index d04709f6c29b193aebe8941e5581609aa898ca7c..1a5553d7a82b5dccd83854290d81e46b8535014b 100644 (file)
@@ -757,6 +757,7 @@ public class DfsReader extends ObjectReader implements ObjectReuseAsIs {
         */
        int inflate(DfsPackFile pack, long position, byte[] dstbuf,
                        boolean headerOnly) throws IOException, DataFormatException {
+               long start = System.nanoTime();
                prepareInflater();
                pin(pack, position);
                position += block.setInput(position, inf);
@@ -765,6 +766,7 @@ public class DfsReader extends ObjectReader implements ObjectReuseAsIs {
                        dstoff += n;
                        if (inf.finished() || (headerOnly && dstoff == dstbuf.length)) {
                                stats.inflatedBytes += dstoff;
+                               stats.inflationMicros += BlockBasedFile.elapsedMicros(start);
                                return dstoff;
                        } else if (inf.needsInput()) {
                                pin(pack, position);
index c35801f3b051ddaf620422c6c0e9a75687fc4ad4..d6401a16406ae273a054995147b1a468072a9c9d 100644 (file)
@@ -85,6 +85,9 @@ public class DfsReaderIoStats {
                /** Total number of bytes decompressed. */
                long inflatedBytes;
 
+               /** Total microseconds spent inflating compressed bytes. */
+               long inflationMicros;
+
                Accumulator() {
                }
        }
@@ -186,4 +189,13 @@ public class DfsReaderIoStats {
        public long getInflatedBytes() {
                return stats.inflatedBytes;
        }
+
+       /**
+        * Get total microseconds spent inflating compressed bytes.
+        *
+        * @return total microseconds inflating compressed bytes.
+        */
+       public long getInflationMicros() {
+               return stats.inflationMicros;
+       }
 }