From e48410ae9a26b8bac282e863f0c4969ce1a34fe2 Mon Sep 17 00:00:00 2001 From: Terry Parker Date: Wed, 6 Mar 2019 10:01:16 -0800 Subject: [PATCH] Track object inflation time in DfsReaderIoStats 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 --- .../eclipse/jgit/internal/storage/dfs/DfsReader.java | 2 ++ .../jgit/internal/storage/dfs/DfsReaderIoStats.java | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java index d04709f6c..1a5553d7a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java @@ -757,6 +757,7 @@ int copy(BlockBasedFile file, long position, byte[] dstbuf, int dstoff, */ 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 @@ int inflate(DfsPackFile pack, long position, byte[] dstbuf, 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); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReaderIoStats.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReaderIoStats.java index c35801f3b..d6401a164 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReaderIoStats.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReaderIoStats.java @@ -85,6 +85,9 @@ public static class Accumulator { /** Total number of bytes decompressed. */ long inflatedBytes; + /** Total microseconds spent inflating compressed bytes. */ + long inflationMicros; + Accumulator() { } } @@ -186,4 +189,13 @@ public long getReadBlocksMicros() { 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; + } }