]>
Commit | Line | Data |
---|---|---|
b1bae816 LV |
1 | /* |
2 | * Interface for configuring and controlling the state of tracing events. | |
3 | * | |
17f7ac75 | 4 | * Copyright (C) 2011-2016 Lluís Vilanova <vilanova@ac.upc.edu> |
b1bae816 LV |
5 | * |
6 | * This work is licensed under the terms of the GNU GPL, version 2 or later. | |
7 | * See the COPYING file in the top-level directory. | |
8 | */ | |
9 | ||
10 | #ifndef TRACE__CONTROL_INTERNAL_H | |
11 | #define TRACE__CONTROL_INTERNAL_H | |
12 | ||
43b48cfc | 13 | extern int trace_events_enabled_count; |
b1bae816 LV |
14 | |
15 | ||
b1bae816 LV |
16 | static inline bool trace_event_is_pattern(const char *str) |
17 | { | |
18 | assert(str != NULL); | |
19 | return strchr(str, '*') != NULL; | |
20 | } | |
21 | ||
ef4c9fc8 | 22 | static inline uint32_t trace_event_get_id(TraceEvent *ev) |
b1bae816 LV |
23 | { |
24 | assert(ev != NULL); | |
25 | return ev->id; | |
26 | } | |
27 | ||
ef4c9fc8 | 28 | static inline uint32_t trace_event_get_vcpu_id(TraceEvent *ev) |
17f7ac75 LV |
29 | { |
30 | return ev->vcpu_id; | |
31 | } | |
32 | ||
33 | static inline bool trace_event_is_vcpu(TraceEvent *ev) | |
34 | { | |
ef4c9fc8 | 35 | return ev->vcpu_id != TRACE_VCPU_EVENT_NONE; |
17f7ac75 LV |
36 | } |
37 | ||
b1bae816 LV |
38 | static inline const char * trace_event_get_name(TraceEvent *ev) |
39 | { | |
40 | assert(ev != NULL); | |
41 | return ev->name; | |
42 | } | |
43 | ||
44 | static inline bool trace_event_get_state_static(TraceEvent *ev) | |
45 | { | |
46 | assert(ev != NULL); | |
47 | return ev->sstate; | |
48 | } | |
49 | ||
93977402 DB |
50 | /* it's on fast path, avoid consistency checks (asserts) */ |
51 | #define trace_event_get_state_dynamic_by_id(id) \ | |
52 | (unlikely(trace_events_enabled_count) && _ ## id ## _DSTATE) | |
585ec727 | 53 | |
b1bae816 LV |
54 | static inline bool trace_event_get_state_dynamic(TraceEvent *ev) |
55 | { | |
93977402 | 56 | return unlikely(trace_events_enabled_count) && *ev->dstate; |
b1bae816 LV |
57 | } |
58 | ||
fe4db84d DB |
59 | void trace_event_register_group(TraceEvent **events); |
60 | ||
175de524 | 61 | #endif /* TRACE__CONTROL_INTERNAL_H */ |