aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/compiler.h
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2017-01-19 08:57:14 -0500
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2017-01-19 08:57:14 -0500
commit134e6a034cb004ed5acd3048792de70ced1c6cf5 (patch)
treeb4947b475cca5c6c9b5ec78685d0b40e26943518 /include/linux/compiler.h
parentd45ae1f7041ac52ade6c5ec76d96bbed765d67aa (diff)
tracing: Show number of constants profiled in likely profiler
Now that constants are traced, it is useful to see the number of constants that are traced in the likely/unlikely profiler in order to know if they should be ignored or not. The likely/unlikely will display a number after the "correct" number if a "constant" count exists. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'include/linux/compiler.h')
-rw-r--r--include/linux/compiler.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index bbbe1570de1c..a73cc9afa784 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -101,13 +101,18 @@ struct ftrace_branch_data {
101 }; 101 };
102}; 102};
103 103
104struct ftrace_likely_data {
105 struct ftrace_branch_data data;
106 unsigned long constant;
107};
108
104/* 109/*
105 * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code 110 * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code
106 * to disable branch tracing on a per file basis. 111 * to disable branch tracing on a per file basis.
107 */ 112 */
108#if defined(CONFIG_TRACE_BRANCH_PROFILING) \ 113#if defined(CONFIG_TRACE_BRANCH_PROFILING) \
109 && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__) 114 && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__)
110void ftrace_likely_update(struct ftrace_branch_data *f, int val, 115void ftrace_likely_update(struct ftrace_likely_data *f, int val,
111 int expect, int is_constant); 116 int expect, int is_constant);
112 117
113#define likely_notrace(x) __builtin_expect(!!(x), 1) 118#define likely_notrace(x) __builtin_expect(!!(x), 1)
@@ -115,13 +120,13 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val,
115 120
116#define __branch_check__(x, expect, is_constant) ({ \ 121#define __branch_check__(x, expect, is_constant) ({ \
117 int ______r; \ 122 int ______r; \
118 static struct ftrace_branch_data \ 123 static struct ftrace_likely_data \
119 __attribute__((__aligned__(4))) \ 124 __attribute__((__aligned__(4))) \
120 __attribute__((section("_ftrace_annotated_branch"))) \ 125 __attribute__((section("_ftrace_annotated_branch"))) \
121 ______f = { \ 126 ______f = { \
122 .func = __func__, \ 127 .data.func = __func__, \
123 .file = __FILE__, \ 128 .data.file = __FILE__, \
124 .line = __LINE__, \ 129 .data.line = __LINE__, \
125 }; \ 130 }; \
126 ______r = __builtin_expect(!!(x), expect); \ 131 ______r = __builtin_expect(!!(x), expect); \
127 ftrace_likely_update(&______f, ______r, \ 132 ftrace_likely_update(&______f, ______r, \