xfs_stats.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /*
  2. * Copyright (c) 2000,2005 Silicon Graphics, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it would be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write the Free Software Foundation,
  16. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef __XFS_STATS_H__
  19. #define __XFS_STATS_H__
  20. #if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF)
  21. #include <linux/percpu.h>
  22. /*
  23. * XFS global statistics
  24. */
  25. struct xfsstats {
  26. # define XFSSTAT_END_EXTENT_ALLOC 4
  27. __uint32_t xs_allocx;
  28. __uint32_t xs_allocb;
  29. __uint32_t xs_freex;
  30. __uint32_t xs_freeb;
  31. # define XFSSTAT_END_ALLOC_BTREE (XFSSTAT_END_EXTENT_ALLOC+4)
  32. __uint32_t xs_abt_lookup;
  33. __uint32_t xs_abt_compare;
  34. __uint32_t xs_abt_insrec;
  35. __uint32_t xs_abt_delrec;
  36. # define XFSSTAT_END_BLOCK_MAPPING (XFSSTAT_END_ALLOC_BTREE+7)
  37. __uint32_t xs_blk_mapr;
  38. __uint32_t xs_blk_mapw;
  39. __uint32_t xs_blk_unmap;
  40. __uint32_t xs_add_exlist;
  41. __uint32_t xs_del_exlist;
  42. __uint32_t xs_look_exlist;
  43. __uint32_t xs_cmp_exlist;
  44. # define XFSSTAT_END_BLOCK_MAP_BTREE (XFSSTAT_END_BLOCK_MAPPING+4)
  45. __uint32_t xs_bmbt_lookup;
  46. __uint32_t xs_bmbt_compare;
  47. __uint32_t xs_bmbt_insrec;
  48. __uint32_t xs_bmbt_delrec;
  49. # define XFSSTAT_END_DIRECTORY_OPS (XFSSTAT_END_BLOCK_MAP_BTREE+4)
  50. __uint32_t xs_dir_lookup;
  51. __uint32_t xs_dir_create;
  52. __uint32_t xs_dir_remove;
  53. __uint32_t xs_dir_getdents;
  54. # define XFSSTAT_END_TRANSACTIONS (XFSSTAT_END_DIRECTORY_OPS+3)
  55. __uint32_t xs_trans_sync;
  56. __uint32_t xs_trans_async;
  57. __uint32_t xs_trans_empty;
  58. # define XFSSTAT_END_INODE_OPS (XFSSTAT_END_TRANSACTIONS+7)
  59. __uint32_t xs_ig_attempts;
  60. __uint32_t xs_ig_found;
  61. __uint32_t xs_ig_frecycle;
  62. __uint32_t xs_ig_missed;
  63. __uint32_t xs_ig_dup;
  64. __uint32_t xs_ig_reclaims;
  65. __uint32_t xs_ig_attrchg;
  66. # define XFSSTAT_END_LOG_OPS (XFSSTAT_END_INODE_OPS+5)
  67. __uint32_t xs_log_writes;
  68. __uint32_t xs_log_blocks;
  69. __uint32_t xs_log_noiclogs;
  70. __uint32_t xs_log_force;
  71. __uint32_t xs_log_force_sleep;
  72. # define XFSSTAT_END_TAIL_PUSHING (XFSSTAT_END_LOG_OPS+10)
  73. __uint32_t xs_try_logspace;
  74. __uint32_t xs_sleep_logspace;
  75. __uint32_t xs_push_ail;
  76. __uint32_t xs_push_ail_success;
  77. __uint32_t xs_push_ail_pushbuf;
  78. __uint32_t xs_push_ail_pinned;
  79. __uint32_t xs_push_ail_locked;
  80. __uint32_t xs_push_ail_flushing;
  81. __uint32_t xs_push_ail_restarts;
  82. __uint32_t xs_push_ail_flush;
  83. # define XFSSTAT_END_WRITE_CONVERT (XFSSTAT_END_TAIL_PUSHING+2)
  84. __uint32_t xs_xstrat_quick;
  85. __uint32_t xs_xstrat_split;
  86. # define XFSSTAT_END_READ_WRITE_OPS (XFSSTAT_END_WRITE_CONVERT+2)
  87. __uint32_t xs_write_calls;
  88. __uint32_t xs_read_calls;
  89. # define XFSSTAT_END_ATTRIBUTE_OPS (XFSSTAT_END_READ_WRITE_OPS+4)
  90. __uint32_t xs_attr_get;
  91. __uint32_t xs_attr_set;
  92. __uint32_t xs_attr_remove;
  93. __uint32_t xs_attr_list;
  94. # define XFSSTAT_END_INODE_CLUSTER (XFSSTAT_END_ATTRIBUTE_OPS+3)
  95. __uint32_t xs_iflush_count;
  96. __uint32_t xs_icluster_flushcnt;
  97. __uint32_t xs_icluster_flushinode;
  98. # define XFSSTAT_END_VNODE_OPS (XFSSTAT_END_INODE_CLUSTER+8)
  99. __uint32_t vn_active; /* # vnodes not on free lists */
  100. __uint32_t vn_alloc; /* # times vn_alloc called */
  101. __uint32_t vn_get; /* # times vn_get called */
  102. __uint32_t vn_hold; /* # times vn_hold called */
  103. __uint32_t vn_rele; /* # times vn_rele called */
  104. __uint32_t vn_reclaim; /* # times vn_reclaim called */
  105. __uint32_t vn_remove; /* # times vn_remove called */
  106. __uint32_t vn_free; /* # times vn_free called */
  107. #define XFSSTAT_END_BUF (XFSSTAT_END_VNODE_OPS+9)
  108. __uint32_t xb_get;
  109. __uint32_t xb_create;
  110. __uint32_t xb_get_locked;
  111. __uint32_t xb_get_locked_waited;
  112. __uint32_t xb_busy_locked;
  113. __uint32_t xb_miss_locked;
  114. __uint32_t xb_page_retries;
  115. __uint32_t xb_page_found;
  116. __uint32_t xb_get_read;
  117. /* Version 2 btree counters */
  118. #define XFSSTAT_END_ABTB_V2 (XFSSTAT_END_BUF+15)
  119. __uint32_t xs_abtb_2_lookup;
  120. __uint32_t xs_abtb_2_compare;
  121. __uint32_t xs_abtb_2_insrec;
  122. __uint32_t xs_abtb_2_delrec;
  123. __uint32_t xs_abtb_2_newroot;
  124. __uint32_t xs_abtb_2_killroot;
  125. __uint32_t xs_abtb_2_increment;
  126. __uint32_t xs_abtb_2_decrement;
  127. __uint32_t xs_abtb_2_lshift;
  128. __uint32_t xs_abtb_2_rshift;
  129. __uint32_t xs_abtb_2_split;
  130. __uint32_t xs_abtb_2_join;
  131. __uint32_t xs_abtb_2_alloc;
  132. __uint32_t xs_abtb_2_free;
  133. __uint32_t xs_abtb_2_moves;
  134. #define XFSSTAT_END_ABTC_V2 (XFSSTAT_END_ABTB_V2+15)
  135. __uint32_t xs_abtc_2_lookup;
  136. __uint32_t xs_abtc_2_compare;
  137. __uint32_t xs_abtc_2_insrec;
  138. __uint32_t xs_abtc_2_delrec;
  139. __uint32_t xs_abtc_2_newroot;
  140. __uint32_t xs_abtc_2_killroot;
  141. __uint32_t xs_abtc_2_increment;
  142. __uint32_t xs_abtc_2_decrement;
  143. __uint32_t xs_abtc_2_lshift;
  144. __uint32_t xs_abtc_2_rshift;
  145. __uint32_t xs_abtc_2_split;
  146. __uint32_t xs_abtc_2_join;
  147. __uint32_t xs_abtc_2_alloc;
  148. __uint32_t xs_abtc_2_free;
  149. __uint32_t xs_abtc_2_moves;
  150. #define XFSSTAT_END_BMBT_V2 (XFSSTAT_END_ABTC_V2+15)
  151. __uint32_t xs_bmbt_2_lookup;
  152. __uint32_t xs_bmbt_2_compare;
  153. __uint32_t xs_bmbt_2_insrec;
  154. __uint32_t xs_bmbt_2_delrec;
  155. __uint32_t xs_bmbt_2_newroot;
  156. __uint32_t xs_bmbt_2_killroot;
  157. __uint32_t xs_bmbt_2_increment;
  158. __uint32_t xs_bmbt_2_decrement;
  159. __uint32_t xs_bmbt_2_lshift;
  160. __uint32_t xs_bmbt_2_rshift;
  161. __uint32_t xs_bmbt_2_split;
  162. __uint32_t xs_bmbt_2_join;
  163. __uint32_t xs_bmbt_2_alloc;
  164. __uint32_t xs_bmbt_2_free;
  165. __uint32_t xs_bmbt_2_moves;
  166. #define XFSSTAT_END_IBT_V2 (XFSSTAT_END_BMBT_V2+15)
  167. __uint32_t xs_ibt_2_lookup;
  168. __uint32_t xs_ibt_2_compare;
  169. __uint32_t xs_ibt_2_insrec;
  170. __uint32_t xs_ibt_2_delrec;
  171. __uint32_t xs_ibt_2_newroot;
  172. __uint32_t xs_ibt_2_killroot;
  173. __uint32_t xs_ibt_2_increment;
  174. __uint32_t xs_ibt_2_decrement;
  175. __uint32_t xs_ibt_2_lshift;
  176. __uint32_t xs_ibt_2_rshift;
  177. __uint32_t xs_ibt_2_split;
  178. __uint32_t xs_ibt_2_join;
  179. __uint32_t xs_ibt_2_alloc;
  180. __uint32_t xs_ibt_2_free;
  181. __uint32_t xs_ibt_2_moves;
  182. /* Extra precision counters */
  183. __uint64_t xs_xstrat_bytes;
  184. __uint64_t xs_write_bytes;
  185. __uint64_t xs_read_bytes;
  186. };
  187. DECLARE_PER_CPU(struct xfsstats, xfsstats);
  188. /*
  189. * We don't disable preempt, not too worried about poking the
  190. * wrong CPU's stat for now (also aggregated before reporting).
  191. */
  192. #define XFS_STATS_INC(v) (per_cpu(xfsstats, current_cpu()).v++)
  193. #define XFS_STATS_DEC(v) (per_cpu(xfsstats, current_cpu()).v--)
  194. #define XFS_STATS_ADD(v, inc) (per_cpu(xfsstats, current_cpu()).v += (inc))
  195. extern int xfs_init_procfs(void);
  196. extern void xfs_cleanup_procfs(void);
  197. #else /* !CONFIG_PROC_FS */
  198. # define XFS_STATS_INC(count)
  199. # define XFS_STATS_DEC(count)
  200. # define XFS_STATS_ADD(count, inc)
  201. static inline int xfs_init_procfs(void)
  202. {
  203. return 0;
  204. }
  205. static inline void xfs_cleanup_procfs(void)
  206. {
  207. }
  208. #endif /* !CONFIG_PROC_FS */
  209. #endif /* __XFS_STATS_H__ */