aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--parse-events.h3
-rw-r--r--trace-cmd.h2
-rw-r--r--trace-ftrace.c6
-rw-r--r--trace-input.c9
-rw-r--r--trace-read.c20
6 files changed, 17 insertions, 25 deletions
diff --git a/Makefile b/Makefile
index 1f9e2e5..de4fdc4 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,8 @@ LIB_FILE = libtracecmd.a
17 17
18trace-read.o:: parse-events.h 18trace-read.o:: parse-events.h
19trace-cmd.o:: parse-events.h $(LIB_FILE) 19trace-cmd.o:: parse-events.h $(LIB_FILE)
20trace-util.o:: parse-events.h
21trace-ftrace.o:: parse-events.h
20 22
21trace-cmd:: trace-cmd.o trace-read.o 23trace-cmd:: trace-cmd.o trace-read.o
22 $(CC) $^ $(LIBS) -rdynamic -o $@ 24 $(CC) $^ $(LIBS) -rdynamic -o $@
diff --git a/parse-events.h b/parse-events.h
index 074adb1..dbc1134 100644
--- a/parse-events.h
+++ b/parse-events.h
@@ -202,9 +202,6 @@ struct record {
202 void *data; 202 void *data;
203}; 203};
204 204
205struct record *trace_peek_data(int cpu);
206struct record *trace_read_data(int cpu);
207
208extern int old_format; 205extern int old_format;
209 206
210void parse_set_info(int nr_cpus, int long_sz); 207void parse_set_info(int nr_cpus, int long_sz);
diff --git a/trace-cmd.h b/trace-cmd.h
index 34e4012..5c9a405 100644
--- a/trace-cmd.h
+++ b/trace-cmd.h
@@ -44,5 +44,7 @@ tracecmd_read_data(struct tracecmd_handle *handle, int cpu);
44 44
45int tracecmd_ftrace_overrides(void); 45int tracecmd_ftrace_overrides(void);
46 46
47/* hack for function graph work around */
48extern __thread struct tracecmd_handle *tracecmd_curr_thread_handle;
47 49
48#endif /* _TRACE_CMD_H */ 50#endif /* _TRACE_CMD_H */
diff --git a/trace-ftrace.c b/trace-ftrace.c
index 16b012e..2a6c227 100644
--- a/trace-ftrace.c
+++ b/trace-ftrace.c
@@ -2,7 +2,7 @@
2#include <stdlib.h> 2#include <stdlib.h>
3#include <string.h> 3#include <string.h>
4 4
5#include "parse-events.h" 5#include "trace-cmd.h"
6 6
7static struct event *fgraph_ret_event; 7static struct event *fgraph_ret_event;
8static int fgraph_ret_id; 8static int fgraph_ret_id;
@@ -86,7 +86,7 @@ get_return_for_leaf(struct trace_seq *s, int cpu, int cur_pid,
86 return NULL; 86 return NULL;
87 87
88 /* this is a leaf, now advance the iterator */ 88 /* this is a leaf, now advance the iterator */
89 return trace_read_data(cpu); 89 return tracecmd_read_data(tracecmd_curr_thread_handle, cpu);
90} 90}
91 91
92/* Signal a overhead of time execution to the output */ 92/* Signal a overhead of time execution to the output */
@@ -241,7 +241,7 @@ fgraph_ent_handler(struct trace_seq *s, void *data, int size,
241 memcpy(copy_data, data, size); 241 memcpy(copy_data, data, size);
242 data = copy_data; 242 data = copy_data;
243 243
244 rec = trace_peek_data(cpu); 244 rec = tracecmd_peek_data(tracecmd_curr_thread_handle, cpu);
245 if (rec) 245 if (rec)
246 rec = get_return_for_leaf(s, cpu, pid, val, rec); 246 rec = get_return_for_leaf(s, cpu, pid, val, rec);
247 if (rec) 247 if (rec)
diff --git a/trace-input.c b/trace-input.c
index 77db2f5..c3085b8 100644
--- a/trace-input.c
+++ b/trace-input.c
@@ -18,6 +18,7 @@
18 18
19#include "trace-cmd.h" 19#include "trace-cmd.h"
20 20
21
21struct cpu_data { 22struct cpu_data {
22 unsigned long long offset; 23 unsigned long long offset;
23 unsigned long long size; 24 unsigned long long size;
@@ -39,6 +40,7 @@ struct tracecmd_handle {
39 struct cpu_data *cpu_data; 40 struct cpu_data *cpu_data;
40}; 41};
41 42
43__thread struct tracecmd_handle *tracecmd_curr_thread_handle;
42 44
43static int do_read(struct tracecmd_handle *handle, void *data, int size) 45static int do_read(struct tracecmd_handle *handle, void *data, int size)
44{ 46{
@@ -588,6 +590,9 @@ tracecmd_peek_data(struct tracecmd_handle *handle, int cpu)
588 unsigned int delta; 590 unsigned int delta;
589 unsigned int length; 591 unsigned int length;
590 592
593 /* Hack to work around function graph read ahead */
594 tracecmd_curr_thread_handle = handle;
595
591 if (handle->cpu_data[cpu].next) 596 if (handle->cpu_data[cpu].next)
592 return handle->cpu_data[cpu].next; 597 return handle->cpu_data[cpu].next;
593 598
@@ -624,7 +629,7 @@ read_again:
624 if (index >= handle->cpu_data[cpu].page_size) { 629 if (index >= handle->cpu_data[cpu].page_size) {
625 if (get_next_page(handle, cpu)) 630 if (get_next_page(handle, cpu))
626 return NULL; 631 return NULL;
627 return trace_peek_data(cpu); 632 return tracecmd_peek_data(handle, cpu);
628 } 633 }
629 634
630 if (old_format) { 635 if (old_format) {
@@ -700,7 +705,7 @@ tracecmd_read_data(struct tracecmd_handle *handle, int cpu)
700{ 705{
701 struct record *data; 706 struct record *data;
702 707
703 data = trace_peek_data(cpu); 708 data = tracecmd_peek_data(handle, cpu);
704 handle->cpu_data[cpu].next = NULL; 709 handle->cpu_data[cpu].next = NULL;
705 710
706 return data; 711 return data;
diff --git a/trace-read.c b/trace-read.c
index 1c30f46..7fb4021 100644
--- a/trace-read.c
+++ b/trace-read.c
@@ -48,26 +48,12 @@ static int filter_cpu = -1;
48 48
49struct tracecmd_handle *trace_handle; 49struct tracecmd_handle *trace_handle;
50 50
51struct record *trace_peek_data(int cpu) 51static void show_data(struct tracecmd_handle *handle, int cpu)
52{
53 /* work around for libparsevent */
54
55 return tracecmd_peek_data(trace_handle, cpu);
56}
57
58struct record *trace_read_data(int cpu)
59{
60 /* work around for libparsevent */
61
62 return tracecmd_read_data(trace_handle, cpu);
63}
64
65static void show_data(int cpu)
66{ 52{
67 struct record *record; 53 struct record *record;
68 struct trace_seq s; 54 struct trace_seq s;
69 55
70 record = trace_read_data(cpu); 56 record = tracecmd_read_data(handle, cpu);
71 57
72 trace_seq_init(&s); 58 trace_seq_init(&s);
73 pevent_print_event(&s, cpu, record->data, record->size, record->ts); 59 pevent_print_event(&s, cpu, record->data, record->size, record->ts);
@@ -131,7 +117,7 @@ static void read_data_info(struct tracecmd_handle *handle)
131 } 117 }
132 } 118 }
133 if (next >= 0) 119 if (next >= 0)
134 show_data(next); 120 show_data(handle, next);
135 121
136 } while (next >= 0); 122 } while (next >= 0);
137} 123}