xfs_stats.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*
  2. * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of version 2 of the GNU General Public License as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it would be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. *
  12. * Further, this software is distributed without any warranty that it is
  13. * free of the rightful claim of any third person regarding infringement
  14. * or the like. Any license provided herein, whether implied or
  15. * otherwise, applies only to this software file. Patent licenses, if
  16. * any, provided herein do not apply to combinations of this program with
  17. * other software, or any other product whatsoever.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write the Free Software Foundation, Inc., 59
  21. * Temple Place - Suite 330, Boston MA 02111-1307, USA.
  22. *
  23. * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
  24. * Mountain View, CA 94043, or:
  25. *
  26. * http://www.sgi.com
  27. *
  28. * For further information regarding this notice, see:
  29. *
  30. * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
  31. */
  32. #ifndef __XFS_STATS_H__
  33. #define __XFS_STATS_H__
  34. #if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF)
  35. #include <linux/percpu.h>
  36. /*
  37. * XFS global statistics
  38. */
  39. struct xfsstats {
  40. # define XFSSTAT_END_EXTENT_ALLOC 4
  41. __uint32_t xs_allocx;
  42. __uint32_t xs_allocb;
  43. __uint32_t xs_freex;
  44. __uint32_t xs_freeb;
  45. # define XFSSTAT_END_ALLOC_BTREE (XFSSTAT_END_EXTENT_ALLOC+4)
  46. __uint32_t xs_abt_lookup;
  47. __uint32_t xs_abt_compare;
  48. __uint32_t xs_abt_insrec;
  49. __uint32_t xs_abt_delrec;
  50. # define XFSSTAT_END_BLOCK_MAPPING (XFSSTAT_END_ALLOC_BTREE+7)
  51. __uint32_t xs_blk_mapr;
  52. __uint32_t xs_blk_mapw;
  53. __uint32_t xs_blk_unmap;
  54. __uint32_t xs_add_exlist;
  55. __uint32_t xs_del_exlist;
  56. __uint32_t xs_look_exlist;
  57. __uint32_t xs_cmp_exlist;
  58. # define XFSSTAT_END_BLOCK_MAP_BTREE (XFSSTAT_END_BLOCK_MAPPING+4)
  59. __uint32_t xs_bmbt_lookup;
  60. __uint32_t xs_bmbt_compare;
  61. __uint32_t xs_bmbt_insrec;
  62. __uint32_t xs_bmbt_delrec;
  63. # define XFSSTAT_END_DIRECTORY_OPS (XFSSTAT_END_BLOCK_MAP_BTREE+4)
  64. __uint32_t xs_dir_lookup;
  65. __uint32_t xs_dir_create;
  66. __uint32_t xs_dir_remove;
  67. __uint32_t xs_dir_getdents;
  68. # define XFSSTAT_END_TRANSACTIONS (XFSSTAT_END_DIRECTORY_OPS+3)
  69. __uint32_t xs_trans_sync;
  70. __uint32_t xs_trans_async;
  71. __uint32_t xs_trans_empty;
  72. # define XFSSTAT_END_INODE_OPS (XFSSTAT_END_TRANSACTIONS+7)
  73. __uint32_t xs_ig_attempts;
  74. __uint32_t xs_ig_found;
  75. __uint32_t xs_ig_frecycle;
  76. __uint32_t xs_ig_missed;
  77. __uint32_t xs_ig_dup;
  78. __uint32_t xs_ig_reclaims;
  79. __uint32_t xs_ig_attrchg;
  80. # define XFSSTAT_END_LOG_OPS (XFSSTAT_END_INODE_OPS+5)
  81. __uint32_t xs_log_writes;
  82. __uint32_t xs_log_blocks;
  83. __uint32_t xs_log_noiclogs;
  84. __uint32_t xs_log_force;
  85. __uint32_t xs_log_force_sleep;
  86. # define XFSSTAT_END_TAIL_PUSHING (XFSSTAT_END_LOG_OPS+10)
  87. __uint32_t xs_try_logspace;
  88. __uint32_t xs_sleep_logspace;
  89. __uint32_t xs_push_ail;
  90. __uint32_t xs_push_ail_success;
  91. __uint32_t xs_push_ail_pushbuf;
  92. __uint32_t xs_push_ail_pinned;
  93. __uint32_t xs_push_ail_locked;
  94. __uint32_t xs_push_ail_flushing;
  95. __uint32_t xs_push_ail_restarts;
  96. __uint32_t xs_push_ail_flush;
  97. # define XFSSTAT_END_WRITE_CONVERT (XFSSTAT_END_TAIL_PUSHING+2)
  98. __uint32_t xs_xstrat_quick;
  99. __uint32_t xs_xstrat_split;
  100. # define XFSSTAT_END_READ_WRITE_OPS (XFSSTAT_END_WRITE_CONVERT+2)
  101. __uint32_t xs_write_calls;
  102. __uint32_t xs_read_calls;
  103. # define XFSSTAT_END_ATTRIBUTE_OPS (XFSSTAT_END_READ_WRITE_OPS+4)
  104. __uint32_t xs_attr_get;
  105. __uint32_t xs_attr_set;
  106. __uint32_t xs_attr_remove;
  107. __uint32_t xs_attr_list;
  108. # define XFSSTAT_END_INODE_CLUSTER (XFSSTAT_END_ATTRIBUTE_OPS+3)
  109. __uint32_t xs_iflush_count;
  110. __uint32_t xs_icluster_flushcnt;
  111. __uint32_t xs_icluster_flushinode;
  112. # define XFSSTAT_END_VNODE_OPS (XFSSTAT_END_INODE_CLUSTER+8)
  113. __uint32_t vn_active; /* # vnodes not on free lists */
  114. __uint32_t vn_alloc; /* # times vn_alloc called */
  115. __uint32_t vn_get; /* # times vn_get called */
  116. __uint32_t vn_hold; /* # times vn_hold called */
  117. __uint32_t vn_rele; /* # times vn_rele called */
  118. __uint32_t vn_reclaim; /* # times vn_reclaim called */
  119. __uint32_t vn_remove; /* # times vn_remove called */
  120. __uint32_t vn_free; /* # times vn_free called */
  121. #define XFSSTAT_END_BUF (XFSSTAT_END_VNODE_OPS+9)
  122. __uint32_t pb_get;
  123. __uint32_t pb_create;
  124. __uint32_t pb_get_locked;
  125. __uint32_t pb_get_locked_waited;
  126. __uint32_t pb_busy_locked;
  127. __uint32_t pb_miss_locked;
  128. __uint32_t pb_page_retries;
  129. __uint32_t pb_page_found;
  130. __uint32_t pb_get_read;
  131. /* Extra precision counters */
  132. __uint64_t xs_xstrat_bytes;
  133. __uint64_t xs_write_bytes;
  134. __uint64_t xs_read_bytes;
  135. };
  136. DECLARE_PER_CPU(struct xfsstats, xfsstats);
  137. /*
  138. * We don't disable preempt, not too worried about poking the
  139. * wrong CPU's stat for now (also aggregated before reporting).
  140. */
  141. #define XFS_STATS_INC(v) (per_cpu(xfsstats, current_cpu()).v++)
  142. #define XFS_STATS_DEC(v) (per_cpu(xfsstats, current_cpu()).v--)
  143. #define XFS_STATS_ADD(v, inc) (per_cpu(xfsstats, current_cpu()).v += (inc))
  144. extern void xfs_init_procfs(void);
  145. extern void xfs_cleanup_procfs(void);
  146. #else /* !CONFIG_PROC_FS */
  147. # define XFS_STATS_INC(count)
  148. # define XFS_STATS_DEC(count)
  149. # define XFS_STATS_ADD(count, inc)
  150. static __inline void xfs_init_procfs(void) { };
  151. static __inline void xfs_cleanup_procfs(void) { };
  152. #endif /* !CONFIG_PROC_FS */
  153. #endif /* __XFS_STATS_H__ */