vm_perf_overflow_callback have meassage
This commit is contained in:
@@ -44,10 +44,10 @@ void vm_perf_overflow_callback(struct perf_event *event,
|
|||||||
struct perf_event_attr pea = {
|
struct perf_event_attr pea = {
|
||||||
.type = PERF_TYPE_SOFTWARE,
|
.type = PERF_TYPE_SOFTWARE,
|
||||||
.size = sizeof(struct perf_event_attr),
|
.size = sizeof(struct perf_event_attr),
|
||||||
.config = PERF_COUNT_SW_DUMMY,
|
.config = PERF_COUNT_SW_CPU_CLOCK,
|
||||||
.sample_period = 1,
|
.sample_period = 1,
|
||||||
.sample_type = PERF_SAMPLE_CALLCHAIN,
|
.sample_type = PERF_SAMPLE_CALLCHAIN,
|
||||||
// .disabled = 1,
|
.disabled = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <linux/cpumask.h>
|
#include <linux/cpumask.h>
|
||||||
@@ -63,38 +63,39 @@ void setup_perf_event_for_task(struct task_struct *tsk) {
|
|||||||
pr_info("Perf event already created\n");
|
pr_info("Perf event already created\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int cpu;
|
|
||||||
struct perf_event **events;
|
// int cpu;
|
||||||
for_each_possible_cpu(cpu) {
|
// struct perf_event **events;
|
||||||
struct perf_event **event = per_cpu_ptr(events, cpu);
|
// for_each_possible_cpu(cpu) {
|
||||||
if (cpu_is_offline(cpu)) {
|
// struct perf_event **event = per_cpu_ptr(events, cpu);
|
||||||
pr_info("cpu %d is offline\n", cpu);
|
// if (cpu_is_offline(cpu)) {
|
||||||
*event = NULL;
|
// pr_info("cpu %d is offline\n", cpu);
|
||||||
continue;
|
// *event = NULL;
|
||||||
}
|
// continue;
|
||||||
*event = perf_event_create_kernel_counter(&pea, cpu, tsk,
|
// }
|
||||||
vm_perf_overflow_callback, NULL);
|
// *event = perf_event_create_kernel_counter(&pea, cpu, tsk,
|
||||||
|
// vm_perf_overflow_callback, NULL);
|
||||||
|
|
||||||
// perf_event_create_kernel_counter(&pea, cpu, tsk,
|
// // perf_event_create_kernel_counter(&pea, cpu, tsk,
|
||||||
// vm_perf_overflow_callback,
|
// // vm_perf_overflow_callback,
|
||||||
// NULL);
|
// // NULL);
|
||||||
if (IS_ERR(*event)) {
|
// if (IS_ERR(*event)) {
|
||||||
printk(KERN_INFO "create perf event failure\n");
|
// printk(KERN_INFO "create perf event failure\n");
|
||||||
// return -1;
|
// // return -1;
|
||||||
}
|
// }
|
||||||
// perf_event_enable(*event);
|
// perf_event_enable(*event);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// pe = perf_event_create_kernel_counter(&pea, tsk->on_cpu, tsk,
|
// pe = perf_event_create_kernel_counter(&pea, tsk->on_cpu, tsk,
|
||||||
// vm_perf_overflow_callback, NULL);
|
// vm_perf_overflow_callback, NULL);
|
||||||
// // pe = perf_event_create_kernel_counter(&pea, -1, tsk,
|
pe = perf_event_create_kernel_counter(&pea, -1, tsk,
|
||||||
// // vm_perf_overflow_callback, NULL);
|
vm_perf_overflow_callback, NULL);
|
||||||
// if (IS_ERR(pe)) {
|
if (IS_ERR(pe)) {
|
||||||
// pr_info("Error in perf_event_create_kernel_counter\n");
|
pr_info("Error in perf_event_create_kernel_counter\n");
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// perf_event_enable(pe); // enable perf event
|
perf_event_enable(pe); // enable perf event
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user