-
Notifications
You must be signed in to change notification settings - Fork 9
/
pmfs_stats.c
68 lines (59 loc) · 1.23 KB
/
pmfs_stats.c
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "pmfs.h"
const char *Timingstring[TIMING_NUM] =
{
"create",
"unlink",
"readdir",
"xip_read",
"xip_write",
"xip_write_fast",
"internal_write",
"memcpy_read",
"memcpy_write",
"alloc_blocks",
"new_trans",
"add_logentry",
"commit_trans",
"mmap_fault",
"fsync",
"free_tree",
"evict_inode",
"recovery",
};
unsigned long long Timingstats[TIMING_NUM];
u64 Countstats[TIMING_NUM];
atomic64_t fsync_pages = ATOMIC_INIT(0);
void pmfs_print_IO_stats(void)
{
printk("=========== PMFS I/O stats ===========\n");
printk("Fsync %ld pages\n", atomic64_read(&fsync_pages));
}
void pmfs_print_timing_stats(void)
{
int i;
printk("======== PMFS kernel timing stats ========\n");
for (i = 0; i < TIMING_NUM; i++) {
if (measure_timing || Timingstats[i]) {
printk("%s: count %llu, timing %llu, average %llu\n",
Timingstring[i],
Countstats[i],
Timingstats[i],
Countstats[i] ?
Timingstats[i] / Countstats[i] : 0);
} else {
printk("%s: count %llu\n",
Timingstring[i],
Countstats[i]);
}
}
pmfs_print_IO_stats();
}
void pmfs_clear_stats(void)
{
int i;
printk("======== Clear PMFS kernel timing stats ========\n");
for (i = 0; i < TIMING_NUM; i++) {
Countstats[i] = 0;
Timingstats[i] = 0;
}
}