1 #include <linux/cpumask.h>
2 #include <linux/debugfs.h>
4 #include <linux/init.h>
5 #include <linux/percpu.h>
6 #include <linux/types.h>
7 #include <asm/fpu_emulator.h>
10 DEFINE_PER_CPU(struct mips_fpu_emulator_stats
, fpuemustats
);
12 static int fpuemu_stat_get(void *data
, u64
*val
)
15 unsigned long sum
= 0;
17 for_each_online_cpu(cpu
) {
18 struct mips_fpu_emulator_stats
*ps
;
21 ps
= &per_cpu(fpuemustats
, cpu
);
22 pv
= (void *)ps
+ (unsigned long)data
;
23 sum
+= local_read(pv
);
28 DEFINE_SIMPLE_ATTRIBUTE(fops_fpuemu_stat
, fpuemu_stat_get
, NULL
, "%llu\n");
30 extern struct dentry
*mips_debugfs_dir
;
31 static int __init
debugfs_fpuemu(void)
33 struct dentry
*d
, *dir
;
35 if (!mips_debugfs_dir
)
37 dir
= debugfs_create_dir("fpuemustats", mips_debugfs_dir
);
41 #define FPU_EMU_STAT_OFFSET(m) \
42 offsetof(struct mips_fpu_emulator_stats, m)
44 #define FPU_STAT_CREATE(m) \
46 d = debugfs_create_file(#m , S_IRUGO, dir, \
47 (void *)FPU_EMU_STAT_OFFSET(m), \
53 FPU_STAT_CREATE(emulated
);
54 FPU_STAT_CREATE(loads
);
55 FPU_STAT_CREATE(stores
);
56 FPU_STAT_CREATE(cp1ops
);
57 FPU_STAT_CREATE(cp1xops
);
58 FPU_STAT_CREATE(errors
);
59 FPU_STAT_CREATE(ieee754_inexact
);
60 FPU_STAT_CREATE(ieee754_underflow
);
61 FPU_STAT_CREATE(ieee754_overflow
);
62 FPU_STAT_CREATE(ieee754_zerodiv
);
63 FPU_STAT_CREATE(ieee754_invalidop
);
64 FPU_STAT_CREATE(ds_emul
);
68 __initcall(debugfs_fpuemu
);