1 /* 2 * Copyright (C) 2017, Google Inc. and others 3 * 4 * This program and the accompanying materials are made available under the 5 * terms of the Eclipse Distribution License v. 1.0 which is available at 6 * https://www.eclipse.org/org/documents/edl-v10.php. 7 * 8 * SPDX-License-Identifier: BSD-3-Clause 9 */ 10 11 package org.eclipse.jgit.internal.storage.dfs; 12 13 /** 14 * IO statistics for a {@link org.eclipse.jgit.internal.storage.dfs.DfsReader}. 15 */ 16 public class DfsReaderIoStats { 17 /** POJO to accumulate IO statistics. */ 18 public static class Accumulator { 19 /** Number of times the reader explicitly called scanPacks. */ 20 long scanPacks; 21 22 /** Total number of complete pack indexes read into memory. */ 23 long readIdx; 24 25 /** Total number of complete bitmap indexes read into memory. */ 26 long readBitmap; 27 28 /** Total number of bytes read from indexes. */ 29 long readIdxBytes; 30 31 /** Total microseconds spent reading pack or bitmap indexes. */ 32 long readIdxMicros; 33 34 /** Total number of block cache hits. */ 35 long blockCacheHit; 36 37 /** 38 * Total number of discrete blocks actually read from pack file(s), that is, 39 * block cache misses. 40 */ 41 long readBlock; 42 43 /** 44 * Total number of compressed bytes read during cache misses, as block sized 45 * units. 46 */ 47 long readBlockBytes; 48 49 /** Total microseconds spent reading {@link #readBlock} blocks. */ 50 long readBlockMicros; 51 52 /** Total number of bytes decompressed. */ 53 long inflatedBytes; 54 55 /** Total microseconds spent inflating compressed bytes. */ 56 long inflationMicros; 57 58 Accumulator() { 59 } 60 } 61 62 private final Accumulator stats; 63 64 DfsReaderIoStats(Accumulator stats) { 65 this.stats = stats; 66 } 67 68 /** 69 * Get number of times the reader explicitly called scanPacks. 70 * 71 * @return number of times the reader explicitly called scanPacks. 72 */ 73 public long getScanPacks() { 74 return stats.scanPacks; 75 } 76 77 /** 78 * Get total number of complete pack indexes read into memory. 79 * 80 * @return total number of complete pack indexes read into memory. 81 */ 82 public long getReadPackIndexCount() { 83 return stats.readIdx; 84 } 85 86 /** 87 * Get total number of complete bitmap indexes read into memory. 88 * 89 * @return total number of complete bitmap indexes read into memory. 90 */ 91 public long getReadBitmapIndexCount() { 92 return stats.readBitmap; 93 } 94 95 /** 96 * Get total number of bytes read from indexes. 97 * 98 * @return total number of bytes read from indexes. 99 */ 100 public long getReadIndexBytes() { 101 return stats.readIdxBytes; 102 } 103 104 /** 105 * Get total microseconds spent reading pack or bitmap indexes. 106 * 107 * @return total microseconds spent reading pack or bitmap indexes. 108 */ 109 public long getReadIndexMicros() { 110 return stats.readIdxMicros; 111 } 112 113 /** 114 * Get total number of block cache hits. 115 * 116 * @return total number of block cache hits. 117 */ 118 public long getBlockCacheHits() { 119 return stats.blockCacheHit; 120 } 121 122 /** 123 * Get total number of discrete blocks actually read from pack file(s), that 124 * is, block cache misses. 125 * 126 * @return total number of discrete blocks read from pack file(s). 127 */ 128 public long getReadBlocksCount() { 129 return stats.readBlock; 130 } 131 132 /** 133 * Get total number of compressed bytes read during cache misses, as block 134 * sized units. 135 * 136 * @return total number of compressed bytes read as block sized units. 137 */ 138 public long getReadBlocksBytes() { 139 return stats.readBlockBytes; 140 } 141 142 /** 143 * Get total microseconds spent reading blocks during cache misses. 144 * 145 * @return total microseconds spent reading blocks. 146 */ 147 public long getReadBlocksMicros() { 148 return stats.readBlockMicros; 149 } 150 151 /** 152 * Get total number of bytes decompressed. 153 * 154 * @return total number of bytes decompressed. 155 */ 156 public long getInflatedBytes() { 157 return stats.inflatedBytes; 158 } 159 160 /** 161 * Get total microseconds spent inflating compressed bytes. 162 * 163 * @return total microseconds inflating compressed bytes. 164 */ 165 public long getInflationMicros() { 166 return stats.inflationMicros; 167 } 168 }