Commit | Line | Data |
---|---|---|
9dad1eb8 PMF |
1 | /* |
2 | * LTT core in-kernel infrastructure. | |
3 | * | |
4 | * Copyright 2006 - Mathieu Desnoyers mathieu.desnoyers@polymtl.ca | |
5 | * | |
8fc2d8db PMF |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Lesser General Public | |
8 | * License as published by the Free Software Foundation; either | |
9 | * version 2.1 of the License, or (at your option) any later version. | |
10 | * | |
11 | * This library is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * Lesser General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU Lesser General Public | |
17 | * License along with this library; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
9dad1eb8 PMF |
19 | */ |
20 | ||
b6bf28ec | 21 | #include "tracercore.h" |
9dad1eb8 PMF |
22 | |
23 | /* Traces structures */ | |
24 | struct ltt_traces ltt_traces = { | |
0222e121 MD |
25 | .setup_head = CDS_LIST_HEAD_INIT(ltt_traces.setup_head), |
26 | .head = CDS_LIST_HEAD_INIT(ltt_traces.head), | |
9dad1eb8 | 27 | }; |
9dad1eb8 PMF |
28 | |
29 | /* Traces list writer locking */ | |
30 | static DEFINE_MUTEX(ltt_traces_mutex); | |
31 | ||
9dad1eb8 PMF |
32 | void ltt_lock_traces(void) |
33 | { | |
f7b16408 | 34 | pthread_mutex_lock(<t_traces_mutex); |
9dad1eb8 | 35 | } |
9dad1eb8 PMF |
36 | |
37 | void ltt_unlock_traces(void) | |
38 | { | |
f7b16408 | 39 | pthread_mutex_unlock(<t_traces_mutex); |
9dad1eb8 | 40 | } |
9dad1eb8 | 41 | |
b6bf28ec PMF |
42 | //ust// DEFINE_PER_CPU(unsigned int, ltt_nesting); |
43 | //ust// EXPORT_PER_CPU_SYMBOL(ltt_nesting); | |
015d08b6 | 44 | __thread int ltt_nesting; |
9dad1eb8 PMF |
45 | |
46 | int ltt_run_filter_default(void *trace, uint16_t eID) | |
47 | { | |
48 | return 1; | |
49 | } | |
50 | ||
51 | /* This function pointer is protected by a trace activation check */ | |
52 | ltt_run_filter_functor ltt_run_filter = ltt_run_filter_default; | |
9dad1eb8 PMF |
53 | |
54 | void ltt_filter_register(ltt_run_filter_functor func) | |
55 | { | |
56 | ltt_run_filter = func; | |
57 | } | |
9dad1eb8 PMF |
58 | |
59 | void ltt_filter_unregister(void) | |
60 | { | |
61 | ltt_run_filter = ltt_run_filter_default; | |
62 | } |