stats.c 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. /* FS-Cache statistics
  2. *
  3. * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #define FSCACHE_DEBUG_LEVEL THREAD
  12. #include <linux/module.h>
  13. #include <linux/proc_fs.h>
  14. #include <linux/seq_file.h>
  15. #include "internal.h"
  16. /*
  17. * operation counters
  18. */
  19. atomic_t fscache_n_op_pend;
  20. atomic_t fscache_n_op_run;
  21. atomic_t fscache_n_op_enqueue;
  22. atomic_t fscache_n_op_deferred_release;
  23. atomic_t fscache_n_op_initialised;
  24. atomic_t fscache_n_op_release;
  25. atomic_t fscache_n_op_gc;
  26. atomic_t fscache_n_op_cancelled;
  27. atomic_t fscache_n_op_rejected;
  28. atomic_t fscache_n_attr_changed;
  29. atomic_t fscache_n_attr_changed_ok;
  30. atomic_t fscache_n_attr_changed_nobufs;
  31. atomic_t fscache_n_attr_changed_nomem;
  32. atomic_t fscache_n_attr_changed_calls;
  33. atomic_t fscache_n_allocs;
  34. atomic_t fscache_n_allocs_ok;
  35. atomic_t fscache_n_allocs_wait;
  36. atomic_t fscache_n_allocs_nobufs;
  37. atomic_t fscache_n_allocs_intr;
  38. atomic_t fscache_n_allocs_object_dead;
  39. atomic_t fscache_n_alloc_ops;
  40. atomic_t fscache_n_alloc_op_waits;
  41. atomic_t fscache_n_retrievals;
  42. atomic_t fscache_n_retrievals_ok;
  43. atomic_t fscache_n_retrievals_wait;
  44. atomic_t fscache_n_retrievals_nodata;
  45. atomic_t fscache_n_retrievals_nobufs;
  46. atomic_t fscache_n_retrievals_intr;
  47. atomic_t fscache_n_retrievals_nomem;
  48. atomic_t fscache_n_retrievals_object_dead;
  49. atomic_t fscache_n_retrieval_ops;
  50. atomic_t fscache_n_retrieval_op_waits;
  51. atomic_t fscache_n_stores;
  52. atomic_t fscache_n_stores_ok;
  53. atomic_t fscache_n_stores_again;
  54. atomic_t fscache_n_stores_nobufs;
  55. atomic_t fscache_n_stores_oom;
  56. atomic_t fscache_n_store_ops;
  57. atomic_t fscache_n_store_calls;
  58. atomic_t fscache_n_store_pages;
  59. atomic_t fscache_n_store_radix_deletes;
  60. atomic_t fscache_n_store_pages_over_limit;
  61. atomic_t fscache_n_store_vmscan_not_storing;
  62. atomic_t fscache_n_store_vmscan_gone;
  63. atomic_t fscache_n_store_vmscan_busy;
  64. atomic_t fscache_n_store_vmscan_cancelled;
  65. atomic_t fscache_n_store_vmscan_wait;
  66. atomic_t fscache_n_marks;
  67. atomic_t fscache_n_uncaches;
  68. atomic_t fscache_n_acquires;
  69. atomic_t fscache_n_acquires_null;
  70. atomic_t fscache_n_acquires_no_cache;
  71. atomic_t fscache_n_acquires_ok;
  72. atomic_t fscache_n_acquires_nobufs;
  73. atomic_t fscache_n_acquires_oom;
  74. atomic_t fscache_n_invalidates;
  75. atomic_t fscache_n_invalidates_run;
  76. atomic_t fscache_n_updates;
  77. atomic_t fscache_n_updates_null;
  78. atomic_t fscache_n_updates_run;
  79. atomic_t fscache_n_relinquishes;
  80. atomic_t fscache_n_relinquishes_null;
  81. atomic_t fscache_n_relinquishes_waitcrt;
  82. atomic_t fscache_n_relinquishes_retire;
  83. atomic_t fscache_n_cookie_index;
  84. atomic_t fscache_n_cookie_data;
  85. atomic_t fscache_n_cookie_special;
  86. atomic_t fscache_n_object_alloc;
  87. atomic_t fscache_n_object_no_alloc;
  88. atomic_t fscache_n_object_lookups;
  89. atomic_t fscache_n_object_lookups_negative;
  90. atomic_t fscache_n_object_lookups_positive;
  91. atomic_t fscache_n_object_lookups_timed_out;
  92. atomic_t fscache_n_object_created;
  93. atomic_t fscache_n_object_avail;
  94. atomic_t fscache_n_object_dead;
  95. atomic_t fscache_n_checkaux_none;
  96. atomic_t fscache_n_checkaux_okay;
  97. atomic_t fscache_n_checkaux_update;
  98. atomic_t fscache_n_checkaux_obsolete;
  99. atomic_t fscache_n_cop_alloc_object;
  100. atomic_t fscache_n_cop_lookup_object;
  101. atomic_t fscache_n_cop_lookup_complete;
  102. atomic_t fscache_n_cop_grab_object;
  103. atomic_t fscache_n_cop_invalidate_object;
  104. atomic_t fscache_n_cop_update_object;
  105. atomic_t fscache_n_cop_drop_object;
  106. atomic_t fscache_n_cop_put_object;
  107. atomic_t fscache_n_cop_sync_cache;
  108. atomic_t fscache_n_cop_attr_changed;
  109. atomic_t fscache_n_cop_read_or_alloc_page;
  110. atomic_t fscache_n_cop_read_or_alloc_pages;
  111. atomic_t fscache_n_cop_allocate_page;
  112. atomic_t fscache_n_cop_allocate_pages;
  113. atomic_t fscache_n_cop_write_page;
  114. atomic_t fscache_n_cop_uncache_page;
  115. atomic_t fscache_n_cop_dissociate_pages;
  116. atomic_t fscache_n_cache_no_space_reject;
  117. atomic_t fscache_n_cache_stale_objects;
  118. atomic_t fscache_n_cache_retired_objects;
  119. atomic_t fscache_n_cache_culled_objects;
  120. /*
  121. * display the general statistics
  122. */
  123. int fscache_stats_show(struct seq_file *m, void *v)
  124. {
  125. seq_puts(m, "FS-Cache statistics\n");
  126. seq_printf(m, "Cookies: idx=%u dat=%u spc=%u\n",
  127. atomic_read(&fscache_n_cookie_index),
  128. atomic_read(&fscache_n_cookie_data),
  129. atomic_read(&fscache_n_cookie_special));
  130. seq_printf(m, "Objects: alc=%u nal=%u avl=%u ded=%u\n",
  131. atomic_read(&fscache_n_object_alloc),
  132. atomic_read(&fscache_n_object_no_alloc),
  133. atomic_read(&fscache_n_object_avail),
  134. atomic_read(&fscache_n_object_dead));
  135. seq_printf(m, "ChkAux : non=%u ok=%u upd=%u obs=%u\n",
  136. atomic_read(&fscache_n_checkaux_none),
  137. atomic_read(&fscache_n_checkaux_okay),
  138. atomic_read(&fscache_n_checkaux_update),
  139. atomic_read(&fscache_n_checkaux_obsolete));
  140. seq_printf(m, "Pages : mrk=%u unc=%u\n",
  141. atomic_read(&fscache_n_marks),
  142. atomic_read(&fscache_n_uncaches));
  143. seq_printf(m, "Acquire: n=%u nul=%u noc=%u ok=%u nbf=%u"
  144. " oom=%u\n",
  145. atomic_read(&fscache_n_acquires),
  146. atomic_read(&fscache_n_acquires_null),
  147. atomic_read(&fscache_n_acquires_no_cache),
  148. atomic_read(&fscache_n_acquires_ok),
  149. atomic_read(&fscache_n_acquires_nobufs),
  150. atomic_read(&fscache_n_acquires_oom));
  151. seq_printf(m, "Lookups: n=%u neg=%u pos=%u crt=%u tmo=%u\n",
  152. atomic_read(&fscache_n_object_lookups),
  153. atomic_read(&fscache_n_object_lookups_negative),
  154. atomic_read(&fscache_n_object_lookups_positive),
  155. atomic_read(&fscache_n_object_created),
  156. atomic_read(&fscache_n_object_lookups_timed_out));
  157. seq_printf(m, "Invals : n=%u run=%u\n",
  158. atomic_read(&fscache_n_invalidates),
  159. atomic_read(&fscache_n_invalidates_run));
  160. seq_printf(m, "Updates: n=%u nul=%u run=%u\n",
  161. atomic_read(&fscache_n_updates),
  162. atomic_read(&fscache_n_updates_null),
  163. atomic_read(&fscache_n_updates_run));
  164. seq_printf(m, "Relinqs: n=%u nul=%u wcr=%u rtr=%u\n",
  165. atomic_read(&fscache_n_relinquishes),
  166. atomic_read(&fscache_n_relinquishes_null),
  167. atomic_read(&fscache_n_relinquishes_waitcrt),
  168. atomic_read(&fscache_n_relinquishes_retire));
  169. seq_printf(m, "AttrChg: n=%u ok=%u nbf=%u oom=%u run=%u\n",
  170. atomic_read(&fscache_n_attr_changed),
  171. atomic_read(&fscache_n_attr_changed_ok),
  172. atomic_read(&fscache_n_attr_changed_nobufs),
  173. atomic_read(&fscache_n_attr_changed_nomem),
  174. atomic_read(&fscache_n_attr_changed_calls));
  175. seq_printf(m, "Allocs : n=%u ok=%u wt=%u nbf=%u int=%u\n",
  176. atomic_read(&fscache_n_allocs),
  177. atomic_read(&fscache_n_allocs_ok),
  178. atomic_read(&fscache_n_allocs_wait),
  179. atomic_read(&fscache_n_allocs_nobufs),
  180. atomic_read(&fscache_n_allocs_intr));
  181. seq_printf(m, "Allocs : ops=%u owt=%u abt=%u\n",
  182. atomic_read(&fscache_n_alloc_ops),
  183. atomic_read(&fscache_n_alloc_op_waits),
  184. atomic_read(&fscache_n_allocs_object_dead));
  185. seq_printf(m, "Retrvls: n=%u ok=%u wt=%u nod=%u nbf=%u"
  186. " int=%u oom=%u\n",
  187. atomic_read(&fscache_n_retrievals),
  188. atomic_read(&fscache_n_retrievals_ok),
  189. atomic_read(&fscache_n_retrievals_wait),
  190. atomic_read(&fscache_n_retrievals_nodata),
  191. atomic_read(&fscache_n_retrievals_nobufs),
  192. atomic_read(&fscache_n_retrievals_intr),
  193. atomic_read(&fscache_n_retrievals_nomem));
  194. seq_printf(m, "Retrvls: ops=%u owt=%u abt=%u\n",
  195. atomic_read(&fscache_n_retrieval_ops),
  196. atomic_read(&fscache_n_retrieval_op_waits),
  197. atomic_read(&fscache_n_retrievals_object_dead));
  198. seq_printf(m, "Stores : n=%u ok=%u agn=%u nbf=%u oom=%u\n",
  199. atomic_read(&fscache_n_stores),
  200. atomic_read(&fscache_n_stores_ok),
  201. atomic_read(&fscache_n_stores_again),
  202. atomic_read(&fscache_n_stores_nobufs),
  203. atomic_read(&fscache_n_stores_oom));
  204. seq_printf(m, "Stores : ops=%u run=%u pgs=%u rxd=%u olm=%u\n",
  205. atomic_read(&fscache_n_store_ops),
  206. atomic_read(&fscache_n_store_calls),
  207. atomic_read(&fscache_n_store_pages),
  208. atomic_read(&fscache_n_store_radix_deletes),
  209. atomic_read(&fscache_n_store_pages_over_limit));
  210. seq_printf(m, "VmScan : nos=%u gon=%u bsy=%u can=%u wt=%u\n",
  211. atomic_read(&fscache_n_store_vmscan_not_storing),
  212. atomic_read(&fscache_n_store_vmscan_gone),
  213. atomic_read(&fscache_n_store_vmscan_busy),
  214. atomic_read(&fscache_n_store_vmscan_cancelled),
  215. atomic_read(&fscache_n_store_vmscan_wait));
  216. seq_printf(m, "Ops : pend=%u run=%u enq=%u can=%u rej=%u\n",
  217. atomic_read(&fscache_n_op_pend),
  218. atomic_read(&fscache_n_op_run),
  219. atomic_read(&fscache_n_op_enqueue),
  220. atomic_read(&fscache_n_op_cancelled),
  221. atomic_read(&fscache_n_op_rejected));
  222. seq_printf(m, "Ops : ini=%u dfr=%u rel=%u gc=%u\n",
  223. atomic_read(&fscache_n_op_initialised),
  224. atomic_read(&fscache_n_op_deferred_release),
  225. atomic_read(&fscache_n_op_release),
  226. atomic_read(&fscache_n_op_gc));
  227. seq_printf(m, "CacheOp: alo=%d luo=%d luc=%d gro=%d\n",
  228. atomic_read(&fscache_n_cop_alloc_object),
  229. atomic_read(&fscache_n_cop_lookup_object),
  230. atomic_read(&fscache_n_cop_lookup_complete),
  231. atomic_read(&fscache_n_cop_grab_object));
  232. seq_printf(m, "CacheOp: inv=%d upo=%d dro=%d pto=%d atc=%d syn=%d\n",
  233. atomic_read(&fscache_n_cop_invalidate_object),
  234. atomic_read(&fscache_n_cop_update_object),
  235. atomic_read(&fscache_n_cop_drop_object),
  236. atomic_read(&fscache_n_cop_put_object),
  237. atomic_read(&fscache_n_cop_attr_changed),
  238. atomic_read(&fscache_n_cop_sync_cache));
  239. seq_printf(m, "CacheOp: rap=%d ras=%d alp=%d als=%d wrp=%d ucp=%d dsp=%d\n",
  240. atomic_read(&fscache_n_cop_read_or_alloc_page),
  241. atomic_read(&fscache_n_cop_read_or_alloc_pages),
  242. atomic_read(&fscache_n_cop_allocate_page),
  243. atomic_read(&fscache_n_cop_allocate_pages),
  244. atomic_read(&fscache_n_cop_write_page),
  245. atomic_read(&fscache_n_cop_uncache_page),
  246. atomic_read(&fscache_n_cop_dissociate_pages));
  247. seq_printf(m, "CacheEv: nsp=%d stl=%d rtr=%d cul=%d\n",
  248. atomic_read(&fscache_n_cache_no_space_reject),
  249. atomic_read(&fscache_n_cache_stale_objects),
  250. atomic_read(&fscache_n_cache_retired_objects),
  251. atomic_read(&fscache_n_cache_culled_objects));
  252. return 0;
  253. }