8 #include <linux/kernel.h>
9 #include <linux/types.h>
10 #include <linux/module.h>
12 #include <asm/delay.h>
15 #include <asm/perfmon.h>
22 #define DEFAULT_DEBUG 1
27 if (unlikely(pfm_sysctl.debug >0)) { printk("%s.%d: CPU%d ", __func__, __LINE__, smp_processor_id()); printk a; } \
30 #define DPRINT_ovfl(a) \
32 if (unlikely(pfm_sysctl.debug > 0 && pfm_sysctl.debug_ovfl >0)) { printk("%s.%d: CPU%d ", __func__, __LINE__, smp_processor_id()); printk a; } \
37 #define DPRINT_ovfl(a)
47 DPRINT((
"[%d] no argument passed\n", task_pid_nr(task)));
51 DPRINT((
"[%d] validate flags=0x%x CPU%d\n", task_pid_nr(task), flags, cpu));
90 DPRINT((
"[%d] buffer=%p buf_size=%lu hdr_size=%lu hdr_version=%u cur_offs=%lu\n",
107 unsigned long *
e, entry_size;
108 unsigned int npmds,
i;
109 unsigned char ovfl_pmd;
110 unsigned char ovfl_notify;
113 DPRINT((
"[%d] invalid arguments buf=%p arg=%p\n", task->
pid, buf, arg));
134 entry_size =
sizeof(*ent) + (npmds << 3);
137 e = (
unsigned long *)(ent+1);
141 DPRINT_ovfl((
"[%d] count=%lu cur=%p last=%p free_bytes=%lu ovfl_pmd=%d ovfl_notify=%d npmds=%u\n",
147 ovfl_notify, npmds));
178 for(i=0; i < npmds; i++) {
204 DPRINT_ovfl((
"sampling buffer full free=%lu, count=%lu, ovfl_notify=%d\n", last-cur, hdr->
hdr_count, ovfl_notify));
215 if (ovfl_notify == 0) {
239 ctrl->
bits.mask_monitoring = 0;
240 ctrl->
bits.reset_ovfl_pmds = 1;
248 DPRINT((
"[%d] exit(%p)\n", task_pid_nr(task), buf));
256 .fmt_validate = default_validate,
257 .fmt_getsize = default_get_size,
258 .fmt_init = default_init,
259 .fmt_handler = default_handler,
260 .fmt_restart = default_restart,
261 .fmt_restart_active = default_restart,
262 .fmt_exit = default_exit,
266 pfm_default_smpl_init_module(
void)
272 printk(
"perfmon_default_smpl: %s v%u.%u registered\n",
277 printk(
"perfmon_default_smpl: %s cannot register ret=%d\n",
286 pfm_default_smpl_cleanup_module(
void)
291 printk(
"perfmon_default_smpl: unregister %s=%d\n", default_fmt.
fmt_name, ret);