Blame view

fs/fscache/stats.c 10.5 KB
7394daa8c   David Howells   FS-Cache: Add use...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  /* FS-Cache statistics
   *
   * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
   * Written by David Howells (dhowells@redhat.com)
   *
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License
   * as published by the Free Software Foundation; either version
   * 2 of the License, or (at your option) any later version.
   */
  
  #define FSCACHE_DEBUG_LEVEL THREAD
  #include <linux/module.h>
  #include <linux/proc_fs.h>
  #include <linux/seq_file.h>
  #include "internal.h"
  
  /*
   * operation counters
   */
  atomic_t fscache_n_op_pend;
  atomic_t fscache_n_op_run;
  atomic_t fscache_n_op_enqueue;
  atomic_t fscache_n_op_requeue;
  atomic_t fscache_n_op_deferred_release;
03cdd0e4b   David Howells   FS-Cache: Count t...
26
  atomic_t fscache_n_op_initialised;
7394daa8c   David Howells   FS-Cache: Add use...
27
28
  atomic_t fscache_n_op_release;
  atomic_t fscache_n_op_gc;
5753c4418   David Howells   FS-Cache: Permit ...
29
  atomic_t fscache_n_op_cancelled;
e3d4d28b1   David Howells   FS-Cache: Handle ...
30
  atomic_t fscache_n_op_rejected;
7394daa8c   David Howells   FS-Cache: Add use...
31
32
33
34
35
36
37
38
39
40
41
  
  atomic_t fscache_n_attr_changed;
  atomic_t fscache_n_attr_changed_ok;
  atomic_t fscache_n_attr_changed_nobufs;
  atomic_t fscache_n_attr_changed_nomem;
  atomic_t fscache_n_attr_changed_calls;
  
  atomic_t fscache_n_allocs;
  atomic_t fscache_n_allocs_ok;
  atomic_t fscache_n_allocs_wait;
  atomic_t fscache_n_allocs_nobufs;
5753c4418   David Howells   FS-Cache: Permit ...
42
  atomic_t fscache_n_allocs_intr;
60d543ca7   David Howells   FS-Cache: Start p...
43
  atomic_t fscache_n_allocs_object_dead;
7394daa8c   David Howells   FS-Cache: Add use...
44
45
46
47
48
49
50
51
52
53
  atomic_t fscache_n_alloc_ops;
  atomic_t fscache_n_alloc_op_waits;
  
  atomic_t fscache_n_retrievals;
  atomic_t fscache_n_retrievals_ok;
  atomic_t fscache_n_retrievals_wait;
  atomic_t fscache_n_retrievals_nodata;
  atomic_t fscache_n_retrievals_nobufs;
  atomic_t fscache_n_retrievals_intr;
  atomic_t fscache_n_retrievals_nomem;
60d543ca7   David Howells   FS-Cache: Start p...
54
  atomic_t fscache_n_retrievals_object_dead;
7394daa8c   David Howells   FS-Cache: Add use...
55
56
57
58
59
60
61
62
63
64
  atomic_t fscache_n_retrieval_ops;
  atomic_t fscache_n_retrieval_op_waits;
  
  atomic_t fscache_n_stores;
  atomic_t fscache_n_stores_ok;
  atomic_t fscache_n_stores_again;
  atomic_t fscache_n_stores_nobufs;
  atomic_t fscache_n_stores_oom;
  atomic_t fscache_n_store_ops;
  atomic_t fscache_n_store_calls;
1bccf513a   David Howells   FS-Cache: Fix loc...
65
66
67
  atomic_t fscache_n_store_pages;
  atomic_t fscache_n_store_radix_deletes;
  atomic_t fscache_n_store_pages_over_limit;
7394daa8c   David Howells   FS-Cache: Add use...
68

201a15428   David Howells   FS-Cache: Handle ...
69
70
71
72
  atomic_t fscache_n_store_vmscan_not_storing;
  atomic_t fscache_n_store_vmscan_gone;
  atomic_t fscache_n_store_vmscan_busy;
  atomic_t fscache_n_store_vmscan_cancelled;
8c209ce72   David Howells   NFS: nfs_migrate_...
73
  atomic_t fscache_n_store_vmscan_wait;
201a15428   David Howells   FS-Cache: Handle ...
74

7394daa8c   David Howells   FS-Cache: Add use...
75
76
77
78
79
80
81
82
83
  atomic_t fscache_n_marks;
  atomic_t fscache_n_uncaches;
  
  atomic_t fscache_n_acquires;
  atomic_t fscache_n_acquires_null;
  atomic_t fscache_n_acquires_no_cache;
  atomic_t fscache_n_acquires_ok;
  atomic_t fscache_n_acquires_nobufs;
  atomic_t fscache_n_acquires_oom;
ef778e7ae   David Howells   FS-Cache: Provide...
84
85
  atomic_t fscache_n_invalidates;
  atomic_t fscache_n_invalidates_run;
7394daa8c   David Howells   FS-Cache: Add use...
86
87
88
89
90
91
92
  atomic_t fscache_n_updates;
  atomic_t fscache_n_updates_null;
  atomic_t fscache_n_updates_run;
  
  atomic_t fscache_n_relinquishes;
  atomic_t fscache_n_relinquishes_null;
  atomic_t fscache_n_relinquishes_waitcrt;
2175bb06d   David Howells   FS-Cache: Add a r...
93
  atomic_t fscache_n_relinquishes_retire;
7394daa8c   David Howells   FS-Cache: Add use...
94
95
96
97
98
99
100
101
102
103
  
  atomic_t fscache_n_cookie_index;
  atomic_t fscache_n_cookie_data;
  atomic_t fscache_n_cookie_special;
  
  atomic_t fscache_n_object_alloc;
  atomic_t fscache_n_object_no_alloc;
  atomic_t fscache_n_object_lookups;
  atomic_t fscache_n_object_lookups_negative;
  atomic_t fscache_n_object_lookups_positive;
fee096deb   David Howells   CacheFiles: Catch...
104
  atomic_t fscache_n_object_lookups_timed_out;
7394daa8c   David Howells   FS-Cache: Add use...
105
106
107
108
109
110
111
112
  atomic_t fscache_n_object_created;
  atomic_t fscache_n_object_avail;
  atomic_t fscache_n_object_dead;
  
  atomic_t fscache_n_checkaux_none;
  atomic_t fscache_n_checkaux_okay;
  atomic_t fscache_n_checkaux_update;
  atomic_t fscache_n_checkaux_obsolete;
52bd75fdb   David Howells   FS-Cache: Add cou...
113
114
115
116
  atomic_t fscache_n_cop_alloc_object;
  atomic_t fscache_n_cop_lookup_object;
  atomic_t fscache_n_cop_lookup_complete;
  atomic_t fscache_n_cop_grab_object;
ef778e7ae   David Howells   FS-Cache: Provide...
117
  atomic_t fscache_n_cop_invalidate_object;
52bd75fdb   David Howells   FS-Cache: Add cou...
118
119
120
121
122
123
124
125
126
127
128
129
  atomic_t fscache_n_cop_update_object;
  atomic_t fscache_n_cop_drop_object;
  atomic_t fscache_n_cop_put_object;
  atomic_t fscache_n_cop_sync_cache;
  atomic_t fscache_n_cop_attr_changed;
  atomic_t fscache_n_cop_read_or_alloc_page;
  atomic_t fscache_n_cop_read_or_alloc_pages;
  atomic_t fscache_n_cop_allocate_page;
  atomic_t fscache_n_cop_allocate_pages;
  atomic_t fscache_n_cop_write_page;
  atomic_t fscache_n_cop_uncache_page;
  atomic_t fscache_n_cop_dissociate_pages;
182d919b8   David Howells   FS-Cache: Count c...
130
131
132
133
  atomic_t fscache_n_cache_no_space_reject;
  atomic_t fscache_n_cache_stale_objects;
  atomic_t fscache_n_cache_retired_objects;
  atomic_t fscache_n_cache_culled_objects;
7394daa8c   David Howells   FS-Cache: Add use...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
  /*
   * display the general statistics
   */
  static int fscache_stats_show(struct seq_file *m, void *v)
  {
  	seq_puts(m, "FS-Cache statistics
  ");
  
  	seq_printf(m, "Cookies: idx=%u dat=%u spc=%u
  ",
  		   atomic_read(&fscache_n_cookie_index),
  		   atomic_read(&fscache_n_cookie_data),
  		   atomic_read(&fscache_n_cookie_special));
  
  	seq_printf(m, "Objects: alc=%u nal=%u avl=%u ded=%u
  ",
  		   atomic_read(&fscache_n_object_alloc),
  		   atomic_read(&fscache_n_object_no_alloc),
  		   atomic_read(&fscache_n_object_avail),
  		   atomic_read(&fscache_n_object_dead));
  	seq_printf(m, "ChkAux : non=%u ok=%u upd=%u obs=%u
  ",
  		   atomic_read(&fscache_n_checkaux_none),
  		   atomic_read(&fscache_n_checkaux_okay),
  		   atomic_read(&fscache_n_checkaux_update),
  		   atomic_read(&fscache_n_checkaux_obsolete));
  
  	seq_printf(m, "Pages  : mrk=%u unc=%u
  ",
  		   atomic_read(&fscache_n_marks),
  		   atomic_read(&fscache_n_uncaches));
  
  	seq_printf(m, "Acquire: n=%u nul=%u noc=%u ok=%u nbf=%u"
  		   " oom=%u
  ",
  		   atomic_read(&fscache_n_acquires),
  		   atomic_read(&fscache_n_acquires_null),
  		   atomic_read(&fscache_n_acquires_no_cache),
  		   atomic_read(&fscache_n_acquires_ok),
  		   atomic_read(&fscache_n_acquires_nobufs),
  		   atomic_read(&fscache_n_acquires_oom));
fee096deb   David Howells   CacheFiles: Catch...
175
176
  	seq_printf(m, "Lookups: n=%u neg=%u pos=%u crt=%u tmo=%u
  ",
7394daa8c   David Howells   FS-Cache: Add use...
177
178
179
  		   atomic_read(&fscache_n_object_lookups),
  		   atomic_read(&fscache_n_object_lookups_negative),
  		   atomic_read(&fscache_n_object_lookups_positive),
cc4fc29e5   David Howells   fs-cache: order t...
180
181
  		   atomic_read(&fscache_n_object_created),
  		   atomic_read(&fscache_n_object_lookups_timed_out));
7394daa8c   David Howells   FS-Cache: Add use...
182

ef778e7ae   David Howells   FS-Cache: Provide...
183
184
185
186
  	seq_printf(m, "Invals : n=%u run=%u
  ",
  		   atomic_read(&fscache_n_invalidates),
  		   atomic_read(&fscache_n_invalidates_run));
7394daa8c   David Howells   FS-Cache: Add use...
187
188
189
190
191
  	seq_printf(m, "Updates: n=%u nul=%u run=%u
  ",
  		   atomic_read(&fscache_n_updates),
  		   atomic_read(&fscache_n_updates_null),
  		   atomic_read(&fscache_n_updates_run));
2175bb06d   David Howells   FS-Cache: Add a r...
192
193
  	seq_printf(m, "Relinqs: n=%u nul=%u wcr=%u rtr=%u
  ",
7394daa8c   David Howells   FS-Cache: Add use...
194
195
  		   atomic_read(&fscache_n_relinquishes),
  		   atomic_read(&fscache_n_relinquishes_null),
2175bb06d   David Howells   FS-Cache: Add a r...
196
197
  		   atomic_read(&fscache_n_relinquishes_waitcrt),
  		   atomic_read(&fscache_n_relinquishes_retire));
7394daa8c   David Howells   FS-Cache: Add use...
198
199
200
201
202
203
204
205
  
  	seq_printf(m, "AttrChg: n=%u ok=%u nbf=%u oom=%u run=%u
  ",
  		   atomic_read(&fscache_n_attr_changed),
  		   atomic_read(&fscache_n_attr_changed_ok),
  		   atomic_read(&fscache_n_attr_changed_nobufs),
  		   atomic_read(&fscache_n_attr_changed_nomem),
  		   atomic_read(&fscache_n_attr_changed_calls));
5753c4418   David Howells   FS-Cache: Permit ...
206
207
  	seq_printf(m, "Allocs : n=%u ok=%u wt=%u nbf=%u int=%u
  ",
7394daa8c   David Howells   FS-Cache: Add use...
208
209
210
  		   atomic_read(&fscache_n_allocs),
  		   atomic_read(&fscache_n_allocs_ok),
  		   atomic_read(&fscache_n_allocs_wait),
5753c4418   David Howells   FS-Cache: Permit ...
211
212
  		   atomic_read(&fscache_n_allocs_nobufs),
  		   atomic_read(&fscache_n_allocs_intr));
60d543ca7   David Howells   FS-Cache: Start p...
213
214
  	seq_printf(m, "Allocs : ops=%u owt=%u abt=%u
  ",
7394daa8c   David Howells   FS-Cache: Add use...
215
  		   atomic_read(&fscache_n_alloc_ops),
60d543ca7   David Howells   FS-Cache: Start p...
216
217
  		   atomic_read(&fscache_n_alloc_op_waits),
  		   atomic_read(&fscache_n_allocs_object_dead));
7394daa8c   David Howells   FS-Cache: Add use...
218
219
220
221
222
223
224
225
226
227
228
  
  	seq_printf(m, "Retrvls: n=%u ok=%u wt=%u nod=%u nbf=%u"
  		   " int=%u oom=%u
  ",
  		   atomic_read(&fscache_n_retrievals),
  		   atomic_read(&fscache_n_retrievals_ok),
  		   atomic_read(&fscache_n_retrievals_wait),
  		   atomic_read(&fscache_n_retrievals_nodata),
  		   atomic_read(&fscache_n_retrievals_nobufs),
  		   atomic_read(&fscache_n_retrievals_intr),
  		   atomic_read(&fscache_n_retrievals_nomem));
60d543ca7   David Howells   FS-Cache: Start p...
229
230
  	seq_printf(m, "Retrvls: ops=%u owt=%u abt=%u
  ",
7394daa8c   David Howells   FS-Cache: Add use...
231
  		   atomic_read(&fscache_n_retrieval_ops),
60d543ca7   David Howells   FS-Cache: Start p...
232
233
  		   atomic_read(&fscache_n_retrieval_op_waits),
  		   atomic_read(&fscache_n_retrievals_object_dead));
7394daa8c   David Howells   FS-Cache: Add use...
234
235
236
237
238
239
240
241
  
  	seq_printf(m, "Stores : n=%u ok=%u agn=%u nbf=%u oom=%u
  ",
  		   atomic_read(&fscache_n_stores),
  		   atomic_read(&fscache_n_stores_ok),
  		   atomic_read(&fscache_n_stores_again),
  		   atomic_read(&fscache_n_stores_nobufs),
  		   atomic_read(&fscache_n_stores_oom));
1bccf513a   David Howells   FS-Cache: Fix loc...
242
243
  	seq_printf(m, "Stores : ops=%u run=%u pgs=%u rxd=%u olm=%u
  ",
7394daa8c   David Howells   FS-Cache: Add use...
244
  		   atomic_read(&fscache_n_store_ops),
1bccf513a   David Howells   FS-Cache: Fix loc...
245
246
247
248
  		   atomic_read(&fscache_n_store_calls),
  		   atomic_read(&fscache_n_store_pages),
  		   atomic_read(&fscache_n_store_radix_deletes),
  		   atomic_read(&fscache_n_store_pages_over_limit));
7394daa8c   David Howells   FS-Cache: Add use...
249

8c209ce72   David Howells   NFS: nfs_migrate_...
250
251
  	seq_printf(m, "VmScan : nos=%u gon=%u bsy=%u can=%u wt=%u
  ",
201a15428   David Howells   FS-Cache: Handle ...
252
253
254
  		   atomic_read(&fscache_n_store_vmscan_not_storing),
  		   atomic_read(&fscache_n_store_vmscan_gone),
  		   atomic_read(&fscache_n_store_vmscan_busy),
8c209ce72   David Howells   NFS: nfs_migrate_...
255
256
  		   atomic_read(&fscache_n_store_vmscan_cancelled),
  		   atomic_read(&fscache_n_store_vmscan_wait));
201a15428   David Howells   FS-Cache: Handle ...
257

e3d4d28b1   David Howells   FS-Cache: Handle ...
258
259
  	seq_printf(m, "Ops    : pend=%u run=%u enq=%u can=%u rej=%u
  ",
7394daa8c   David Howells   FS-Cache: Add use...
260
261
  		   atomic_read(&fscache_n_op_pend),
  		   atomic_read(&fscache_n_op_run),
5753c4418   David Howells   FS-Cache: Permit ...
262
  		   atomic_read(&fscache_n_op_enqueue),
e3d4d28b1   David Howells   FS-Cache: Handle ...
263
264
  		   atomic_read(&fscache_n_op_cancelled),
  		   atomic_read(&fscache_n_op_rejected));
03cdd0e4b   David Howells   FS-Cache: Count t...
265
266
267
  	seq_printf(m, "Ops    : ini=%u dfr=%u rel=%u gc=%u
  ",
  		   atomic_read(&fscache_n_op_initialised),
7394daa8c   David Howells   FS-Cache: Add use...
268
269
270
  		   atomic_read(&fscache_n_op_deferred_release),
  		   atomic_read(&fscache_n_op_release),
  		   atomic_read(&fscache_n_op_gc));
52bd75fdb   David Howells   FS-Cache: Add cou...
271
272
273
274
275
276
277
  
  	seq_printf(m, "CacheOp: alo=%d luo=%d luc=%d gro=%d
  ",
  		   atomic_read(&fscache_n_cop_alloc_object),
  		   atomic_read(&fscache_n_cop_lookup_object),
  		   atomic_read(&fscache_n_cop_lookup_complete),
  		   atomic_read(&fscache_n_cop_grab_object));
ef778e7ae   David Howells   FS-Cache: Provide...
278
279
280
  	seq_printf(m, "CacheOp: inv=%d upo=%d dro=%d pto=%d atc=%d syn=%d
  ",
  		   atomic_read(&fscache_n_cop_invalidate_object),
52bd75fdb   David Howells   FS-Cache: Add cou...
281
282
283
284
285
286
287
288
289
290
291
292
293
294
  		   atomic_read(&fscache_n_cop_update_object),
  		   atomic_read(&fscache_n_cop_drop_object),
  		   atomic_read(&fscache_n_cop_put_object),
  		   atomic_read(&fscache_n_cop_attr_changed),
  		   atomic_read(&fscache_n_cop_sync_cache));
  	seq_printf(m, "CacheOp: rap=%d ras=%d alp=%d als=%d wrp=%d ucp=%d dsp=%d
  ",
  		   atomic_read(&fscache_n_cop_read_or_alloc_page),
  		   atomic_read(&fscache_n_cop_read_or_alloc_pages),
  		   atomic_read(&fscache_n_cop_allocate_page),
  		   atomic_read(&fscache_n_cop_allocate_pages),
  		   atomic_read(&fscache_n_cop_write_page),
  		   atomic_read(&fscache_n_cop_uncache_page),
  		   atomic_read(&fscache_n_cop_dissociate_pages));
182d919b8   David Howells   FS-Cache: Count c...
295
296
297
298
299
300
  	seq_printf(m, "CacheEv: nsp=%d stl=%d rtr=%d cul=%d
  ",
  		   atomic_read(&fscache_n_cache_no_space_reject),
  		   atomic_read(&fscache_n_cache_stale_objects),
  		   atomic_read(&fscache_n_cache_retired_objects),
  		   atomic_read(&fscache_n_cache_culled_objects));
7394daa8c   David Howells   FS-Cache: Add use...
301
302
303
304
305
306
307
308
309
310
311
312
  	return 0;
  }
  
  /*
   * open "/proc/fs/fscache/stats" allowing provision of a statistical summary
   */
  static int fscache_stats_open(struct inode *inode, struct file *file)
  {
  	return single_open(file, fscache_stats_show, NULL);
  }
  
  const struct file_operations fscache_stats_fops = {
7394daa8c   David Howells   FS-Cache: Add use...
313
314
315
  	.open		= fscache_stats_open,
  	.read		= seq_read,
  	.llseek		= seq_lseek,
ec686c923   Anurup m   fs/fscache/stats....
316
  	.release        = single_release,
7394daa8c   David Howells   FS-Cache: Add use...
317
  };