2009-03-20 02:26:15 +07:00
|
|
|
/*
|
|
|
|
* trace event based perf counter profiling
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Red Hat Inc, Peter Zijlstra <pzijlstr@redhat.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "trace.h"
|
|
|
|
|
|
|
|
int ftrace_profile_enable(int event_id)
|
|
|
|
{
|
|
|
|
struct ftrace_event_call *event;
|
2009-05-06 09:33:45 +07:00
|
|
|
int ret = -EINVAL;
|
2009-03-20 02:26:15 +07:00
|
|
|
|
2009-05-06 09:33:45 +07:00
|
|
|
mutex_lock(&event_mutex);
|
2009-04-11 00:52:20 +07:00
|
|
|
list_for_each_entry(event, &ftrace_events, list) {
|
2009-08-06 01:41:04 +07:00
|
|
|
if (event->id == event_id && event->profile_enable) {
|
2009-05-06 09:33:45 +07:00
|
|
|
ret = event->profile_enable(event);
|
|
|
|
break;
|
|
|
|
}
|
2009-03-20 02:26:15 +07:00
|
|
|
}
|
2009-05-06 09:33:45 +07:00
|
|
|
mutex_unlock(&event_mutex);
|
2009-03-20 02:26:15 +07:00
|
|
|
|
2009-05-06 09:33:45 +07:00
|
|
|
return ret;
|
2009-03-20 02:26:15 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
void ftrace_profile_disable(int event_id)
|
|
|
|
{
|
|
|
|
struct ftrace_event_call *event;
|
|
|
|
|
2009-05-06 09:33:45 +07:00
|
|
|
mutex_lock(&event_mutex);
|
2009-04-11 00:52:20 +07:00
|
|
|
list_for_each_entry(event, &ftrace_events, list) {
|
2009-05-06 09:33:45 +07:00
|
|
|
if (event->id == event_id) {
|
|
|
|
event->profile_disable(event);
|
|
|
|
break;
|
|
|
|
}
|
2009-03-20 02:26:15 +07:00
|
|
|
}
|
2009-05-06 09:33:45 +07:00
|
|
|
mutex_unlock(&event_mutex);
|
2009-03-20 02:26:15 +07:00
|
|
|
}
|