12 #include <linux/module.h>
24 static int cachefiles_histogram_show(
struct seq_file *
m,
void *
v)
29 switch ((
unsigned long) v) {
31 seq_puts(m,
"JIFS SECS LOOKUPS MKDIRS CREATES\n");
34 seq_puts(m,
"===== ===== ========= ========= =========\n");
37 index = (
unsigned long) v - 3;
38 x =
atomic_read(&cachefiles_lookup_histogram[index]);
39 y =
atomic_read(&cachefiles_mkdir_histogram[index]);
40 z =
atomic_read(&cachefiles_create_histogram[index]);
41 if (x == 0 && y == 0 && z == 0)
44 t = (index * 1000) /
HZ;
46 seq_printf(m,
"%4lu 0.%03u %9u %9u %9u\n", index, t, x, y, z);
54 static void *cachefiles_histogram_start(
struct seq_file *
m, loff_t *_pos)
56 if ((
unsigned long long)*_pos >=
HZ + 2)
60 return (
void *)(
unsigned long) *_pos;
66 static void *cachefiles_histogram_next(
struct seq_file *m,
void *
v, loff_t *
pos)
69 return (
unsigned long long)*pos >
HZ + 2 ?
70 NULL : (
void *)(
unsigned long) *
pos;
76 static void cachefiles_histogram_stop(
struct seq_file *m,
void *v)
81 .start = cachefiles_histogram_start,
82 .stop = cachefiles_histogram_stop,
83 .next = cachefiles_histogram_next,
84 .show = cachefiles_histogram_show,
92 return seq_open(file, &cachefiles_histogram_ops);
97 .open = cachefiles_histogram_open,
113 if (!proc_create(
"fs/cachefiles/histogram",
S_IFREG | 0444,
NULL,
114 &cachefiles_histogram_fops))
115 goto error_histogram;