diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-05-23 15:37:28 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-05-23 15:37:28 -0400 |
commit | 72829bc3d63cdc592d8f7dd86ad3b3fe8900fb74 (patch) | |
tree | c4652b60b17d6087a492387e71c00cec4885cb30 /kernel/trace | |
parent | 86069782d62e731b4835a0cf8eb7d1d0e17cf306 (diff) |
ftrace: move enums to ftrace.h and make helper function global
picked from the mmiotracer patches to distangle the patch queues.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/trace.c | 24 | ||||
-rw-r--r-- | kernel/trace/trace.h | 15 |
2 files changed, 23 insertions, 16 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index ea11f4ebfae1..0eef0503febd 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -37,7 +37,7 @@ unsigned long __read_mostly tracing_thresh; | |||
37 | 37 | ||
38 | static int tracing_disabled = 1; | 38 | static int tracing_disabled = 1; |
39 | 39 | ||
40 | static long | 40 | long |
41 | ns2usecs(cycle_t nsec) | 41 | ns2usecs(cycle_t nsec) |
42 | { | 42 | { |
43 | nsec += 500; | 43 | nsec += 500; |
@@ -96,18 +96,6 @@ unsigned long nsecs_to_usecs(unsigned long nsecs) | |||
96 | return nsecs / 1000; | 96 | return nsecs / 1000; |
97 | } | 97 | } |
98 | 98 | ||
99 | enum trace_type { | ||
100 | __TRACE_FIRST_TYPE = 0, | ||
101 | |||
102 | TRACE_FN, | ||
103 | TRACE_CTX, | ||
104 | TRACE_WAKE, | ||
105 | TRACE_STACK, | ||
106 | TRACE_SPECIAL, | ||
107 | |||
108 | __TRACE_LAST_TYPE | ||
109 | }; | ||
110 | |||
111 | enum trace_flag_type { | 99 | enum trace_flag_type { |
112 | TRACE_FLAG_IRQS_OFF = 0x01, | 100 | TRACE_FLAG_IRQS_OFF = 0x01, |
113 | TRACE_FLAG_NEED_RESCHED = 0x02, | 101 | TRACE_FLAG_NEED_RESCHED = 0x02, |
@@ -190,7 +178,7 @@ void *head_page(struct trace_array_cpu *data) | |||
190 | return page_address(page); | 178 | return page_address(page); |
191 | } | 179 | } |
192 | 180 | ||
193 | static int | 181 | int |
194 | trace_seq_printf(struct trace_seq *s, const char *fmt, ...) | 182 | trace_seq_printf(struct trace_seq *s, const char *fmt, ...) |
195 | { | 183 | { |
196 | int len = (PAGE_SIZE - 1) - s->len; | 184 | int len = (PAGE_SIZE - 1) - s->len; |
@@ -205,7 +193,7 @@ trace_seq_printf(struct trace_seq *s, const char *fmt, ...) | |||
205 | va_end(ap); | 193 | va_end(ap); |
206 | 194 | ||
207 | /* If we can't write it all, don't bother writing anything */ | 195 | /* If we can't write it all, don't bother writing anything */ |
208 | if (ret > len) | 196 | if (ret >= len) |
209 | return 0; | 197 | return 0; |
210 | 198 | ||
211 | s->len += ret; | 199 | s->len += ret; |
@@ -638,7 +626,7 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags) | |||
638 | pc = preempt_count(); | 626 | pc = preempt_count(); |
639 | 627 | ||
640 | entry->preempt_count = pc & 0xff; | 628 | entry->preempt_count = pc & 0xff; |
641 | entry->pid = tsk->pid; | 629 | entry->pid = (tsk) ? tsk->pid : 0; |
642 | entry->t = ftrace_now(raw_smp_processor_id()); | 630 | entry->t = ftrace_now(raw_smp_processor_id()); |
643 | entry->flags = (irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) | | 631 | entry->flags = (irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) | |
644 | ((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) | | 632 | ((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) | |
@@ -1541,6 +1529,9 @@ static int trace_empty(struct trace_iterator *iter) | |||
1541 | 1529 | ||
1542 | static int print_trace_line(struct trace_iterator *iter) | 1530 | static int print_trace_line(struct trace_iterator *iter) |
1543 | { | 1531 | { |
1532 | if (iter->trace && iter->trace->print_line) | ||
1533 | return iter->trace->print_line(iter); | ||
1534 | |||
1544 | if (trace_flags & TRACE_ITER_BIN) | 1535 | if (trace_flags & TRACE_ITER_BIN) |
1545 | return print_bin_fmt(iter); | 1536 | return print_bin_fmt(iter); |
1546 | 1537 | ||
@@ -2162,6 +2153,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp) | |||
2162 | return -ENOMEM; | 2153 | return -ENOMEM; |
2163 | 2154 | ||
2164 | iter->tr = &global_trace; | 2155 | iter->tr = &global_trace; |
2156 | iter->trace = current_trace; | ||
2165 | 2157 | ||
2166 | filp->private_data = iter; | 2158 | filp->private_data = iter; |
2167 | 2159 | ||
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 25cba28eb9ba..b0ca7473671b 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -6,6 +6,18 @@ | |||
6 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
7 | #include <linux/clocksource.h> | 7 | #include <linux/clocksource.h> |
8 | 8 | ||
9 | enum trace_type { | ||
10 | __TRACE_FIRST_TYPE = 0, | ||
11 | |||
12 | TRACE_FN, | ||
13 | TRACE_CTX, | ||
14 | TRACE_WAKE, | ||
15 | TRACE_STACK, | ||
16 | TRACE_SPECIAL, | ||
17 | |||
18 | __TRACE_LAST_TYPE | ||
19 | }; | ||
20 | |||
9 | /* | 21 | /* |
10 | * Function trace entry - function address and parent function addres: | 22 | * Function trace entry - function address and parent function addres: |
11 | */ | 23 | */ |
@@ -130,6 +142,7 @@ struct tracer { | |||
130 | int (*selftest)(struct tracer *trace, | 142 | int (*selftest)(struct tracer *trace, |
131 | struct trace_array *tr); | 143 | struct trace_array *tr); |
132 | #endif | 144 | #endif |
145 | int (*print_line)(struct trace_iterator *iter); | ||
133 | struct tracer *next; | 146 | struct tracer *next; |
134 | int print_max; | 147 | int print_max; |
135 | }; | 148 | }; |
@@ -276,6 +289,8 @@ extern int trace_selftest_startup_sched_switch(struct tracer *trace, | |||
276 | #endif /* CONFIG_FTRACE_STARTUP_TEST */ | 289 | #endif /* CONFIG_FTRACE_STARTUP_TEST */ |
277 | 290 | ||
278 | extern void *head_page(struct trace_array_cpu *data); | 291 | extern void *head_page(struct trace_array_cpu *data); |
292 | extern int trace_seq_printf(struct trace_seq *s, const char *fmt, ...); | ||
293 | extern long ns2usecs(cycle_t nsec); | ||
279 | 294 | ||
280 | extern unsigned long trace_flags; | 295 | extern unsigned long trace_flags; |
281 | 296 | ||