]> bbs.cooldavid.org Git - net-next-2.6.git/blame - kernel/trace/trace_event_profile.c
vsnprintf: remove duplicate comment of vsnprintf
[net-next-2.6.git] / kernel / trace / trace_event_profile.c
CommitLineData
ac199db0
PZ
1/*
2 * trace event based perf counter profiling
3 *
4 * Copyright (C) 2009 Red Hat Inc, Peter Zijlstra <pzijlstr@redhat.com>
5 *
6 */
7
558e6547 8#include <linux/module.h>
ac199db0
PZ
9#include "trace.h"
10
11int ftrace_profile_enable(int event_id)
12{
13 struct ftrace_event_call *event;
20c8928a 14 int ret = -EINVAL;
ac199db0 15
20c8928a 16 mutex_lock(&event_mutex);
a59fd602 17 list_for_each_entry(event, &ftrace_events, list) {
558e6547
LZ
18 if (event->id == event_id && event->profile_enable &&
19 try_module_get(event->mod)) {
20c8928a
LZ
20 ret = event->profile_enable(event);
21 break;
22 }
ac199db0 23 }
20c8928a 24 mutex_unlock(&event_mutex);
ac199db0 25
20c8928a 26 return ret;
ac199db0
PZ
27}
28
29void ftrace_profile_disable(int event_id)
30{
31 struct ftrace_event_call *event;
32
20c8928a 33 mutex_lock(&event_mutex);
a59fd602 34 list_for_each_entry(event, &ftrace_events, list) {
20c8928a
LZ
35 if (event->id == event_id) {
36 event->profile_disable(event);
558e6547 37 module_put(event->mod);
20c8928a
LZ
38 break;
39 }
ac199db0 40 }
20c8928a 41 mutex_unlock(&event_mutex);
ac199db0 42}