diff options
author | Steven Rostedt <srostedt@redhat.com> | 2008-11-21 00:40:40 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-23 05:39:56 -0500 |
commit | 45b797492a0758e64dff74e9db70e1f65e0603a5 (patch) | |
tree | 75db13ee888a6c7f90c92c17a743bff8ce42d86a /include/linux/compiler.h | |
parent | 42f565e116e0408b5ddc21a33c4a4d41fd572420 (diff) |
trace: consolidate unlikely and likely profiler
Impact: clean up to make one profiler of like and unlikely tracer
The likely and unlikely profiler prints out the file and line numbers
of the annotated branches that it is profiling. It shows the number
of times it was correct or incorrect in its guess. Having two
different files or sections for that matter to tell us if it was a
likely or unlikely is pretty pointless. We really only care if
it was correct or not.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/compiler.h')
-rw-r--r-- | include/linux/compiler.h | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index c25e525121f0..0628a2013fae 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -77,32 +77,18 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
77 | #define likely_notrace(x) __builtin_expect(!!(x), 1) | 77 | #define likely_notrace(x) __builtin_expect(!!(x), 1) |
78 | #define unlikely_notrace(x) __builtin_expect(!!(x), 0) | 78 | #define unlikely_notrace(x) __builtin_expect(!!(x), 0) |
79 | 79 | ||
80 | #define likely_check(x) ({ \ | 80 | #define __branch_check__(x, expect) ({ \ |
81 | int ______r; \ | 81 | int ______r; \ |
82 | static struct ftrace_branch_data \ | 82 | static struct ftrace_branch_data \ |
83 | __attribute__((__aligned__(4))) \ | 83 | __attribute__((__aligned__(4))) \ |
84 | __attribute__((section("_ftrace_likely"))) \ | 84 | __attribute__((section("_ftrace_annotated_branch"))) \ |
85 | ______f = { \ | 85 | ______f = { \ |
86 | .func = __func__, \ | 86 | .func = __func__, \ |
87 | .file = __FILE__, \ | 87 | .file = __FILE__, \ |
88 | .line = __LINE__, \ | 88 | .line = __LINE__, \ |
89 | }; \ | 89 | }; \ |
90 | ______r = likely_notrace(x); \ | 90 | ______r = likely_notrace(x); \ |
91 | ftrace_likely_update(&______f, ______r, 1); \ | 91 | ftrace_likely_update(&______f, ______r, expect); \ |
92 | ______r; \ | ||
93 | }) | ||
94 | #define unlikely_check(x) ({ \ | ||
95 | int ______r; \ | ||
96 | static struct ftrace_branch_data \ | ||
97 | __attribute__((__aligned__(4))) \ | ||
98 | __attribute__((section("_ftrace_unlikely"))) \ | ||
99 | ______f = { \ | ||
100 | .func = __func__, \ | ||
101 | .file = __FILE__, \ | ||
102 | .line = __LINE__, \ | ||
103 | }; \ | ||
104 | ______r = unlikely_notrace(x); \ | ||
105 | ftrace_likely_update(&______f, ______r, 0); \ | ||
106 | ______r; \ | 92 | ______r; \ |
107 | }) | 93 | }) |
108 | 94 | ||
@@ -112,10 +98,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
112 | * written by Daniel Walker. | 98 | * written by Daniel Walker. |
113 | */ | 99 | */ |
114 | # ifndef likely | 100 | # ifndef likely |
115 | # define likely(x) (__builtin_constant_p(x) ? !!(x) : likely_check(x)) | 101 | # define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1)) |
116 | # endif | 102 | # endif |
117 | # ifndef unlikely | 103 | # ifndef unlikely |
118 | # define unlikely(x) (__builtin_constant_p(x) ? !!(x) : unlikely_check(x)) | 104 | # define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0)) |
119 | # endif | 105 | # endif |
120 | #else | 106 | #else |
121 | # define likely(x) __builtin_expect(!!(x), 1) | 107 | # define likely(x) __builtin_expect(!!(x), 1) |