You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DfsReaderIoStats.java 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. package org.eclipse.jgit.internal.storage.dfs;
  11. /**
  12. * IO statistics for a {@link org.eclipse.jgit.internal.storage.dfs.DfsReader}.
  13. */
  14. public class DfsReaderIoStats {
  15. /** POJO to accumulate IO statistics. */
  16. public static class Accumulator {
  17. /** Number of times the reader explicitly called scanPacks. */
  18. long scanPacks;
  19. /** Total number of complete pack indexes read into memory. */
  20. long readIdx;
  21. /** Total number of complete bitmap indexes read into memory. */
  22. long readBitmap;
  23. /** Total number of bytes read from indexes. */
  24. long readIdxBytes;
  25. /** Total microseconds spent reading pack or bitmap indexes. */
  26. long readIdxMicros;
  27. /** Total number of block cache hits. */
  28. long blockCacheHit;
  29. /**
  30. * Total number of discrete blocks actually read from pack file(s), that is,
  31. * block cache misses.
  32. */
  33. long readBlock;
  34. /**
  35. * Total number of compressed bytes read during cache misses, as block sized
  36. * units.
  37. */
  38. long readBlockBytes;
  39. /** Total microseconds spent reading {@link #readBlock} blocks. */
  40. long readBlockMicros;
  41. /** Total number of bytes decompressed. */
  42. long inflatedBytes;
  43. /** Total microseconds spent inflating compressed bytes. */
  44. long inflationMicros;
  45. Accumulator() {
  46. }
  47. }
  48. private final Accumulator stats;
  49. DfsReaderIoStats(Accumulator stats) {
  50. this.stats = stats;
  51. }
  52. /**
  53. * Get number of times the reader explicitly called scanPacks.
  54. *
  55. * @return number of times the reader explicitly called scanPacks.
  56. */
  57. public long getScanPacks() {
  58. return stats.scanPacks;
  59. }
  60. /**
  61. * Get total number of complete pack indexes read into memory.
  62. *
  63. * @return total number of complete pack indexes read into memory.
  64. */
  65. public long getReadPackIndexCount() {
  66. return stats.readIdx;
  67. }
  68. /**
  69. * Get total number of complete bitmap indexes read into memory.
  70. *
  71. * @return total number of complete bitmap indexes read into memory.
  72. */
  73. public long getReadBitmapIndexCount() {
  74. return stats.readBitmap;
  75. }
  76. /**
  77. * Get total number of bytes read from indexes.
  78. *
  79. * @return total number of bytes read from indexes.
  80. */
  81. public long getReadIndexBytes() {
  82. return stats.readIdxBytes;
  83. }
  84. /**
  85. * Get total microseconds spent reading pack or bitmap indexes.
  86. *
  87. * @return total microseconds spent reading pack or bitmap indexes.
  88. */
  89. public long getReadIndexMicros() {
  90. return stats.readIdxMicros;
  91. }
  92. /**
  93. * Get total number of block cache hits.
  94. *
  95. * @return total number of block cache hits.
  96. */
  97. public long getBlockCacheHits() {
  98. return stats.blockCacheHit;
  99. }
  100. /**
  101. * Get total number of discrete blocks actually read from pack file(s), that
  102. * is, block cache misses.
  103. *
  104. * @return total number of discrete blocks read from pack file(s).
  105. */
  106. public long getReadBlocksCount() {
  107. return stats.readBlock;
  108. }
  109. /**
  110. * Get total number of compressed bytes read during cache misses, as block
  111. * sized units.
  112. *
  113. * @return total number of compressed bytes read as block sized units.
  114. */
  115. public long getReadBlocksBytes() {
  116. return stats.readBlockBytes;
  117. }
  118. /**
  119. * Get total microseconds spent reading blocks during cache misses.
  120. *
  121. * @return total microseconds spent reading blocks.
  122. */
  123. public long getReadBlocksMicros() {
  124. return stats.readBlockMicros;
  125. }
  126. /**
  127. * Get total number of bytes decompressed.
  128. *
  129. * @return total number of bytes decompressed.
  130. */
  131. public long getInflatedBytes() {
  132. return stats.inflatedBytes;
  133. }
  134. /**
  135. * Get total microseconds spent inflating compressed bytes.
  136. *
  137. * @return total microseconds inflating compressed bytes.
  138. */
  139. public long getInflationMicros() {
  140. return stats.inflationMicros;
  141. }
  142. }