aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-12-04 01:36:01 -0500
committerSteven Rostedt <rostedt@goodmis.org>2009-12-04 01:36:01 -0500
commitdacd5dd2bfe3331e325c2f3a6fc044d3fa6fd03c (patch)
treea5f73eb6800aeedfa89fad2c1ce5c0ef6abf0d2f
parentcd001f7b40f9dd1e5dfbf0c436531a03064f9391 (diff)
Rename tracecmd_handle to tracecmd_input
We will soon be adding write functionality to the tracecmd library. This will require a new and separate handle than what is used by the file reader. "handle" is too generic. Rename it to "input" so we can make the output handle called tracecmd_output. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-cmd.h28
-rw-r--r--trace-ftrace.c2
-rw-r--r--trace-input.c80
-rw-r--r--trace-local.h2
-rw-r--r--trace-read.c8
5 files changed, 60 insertions, 60 deletions
diff --git a/trace-cmd.h b/trace-cmd.h
index cdd31e1..afd7d6b 100644
--- a/trace-cmd.h
+++ b/trace-cmd.h
@@ -34,33 +34,33 @@ struct record {
34 void *data; 34 void *data;
35}; 35};
36 36
37struct tracecmd_handle; 37struct tracecmd_input;
38 38
39struct tracecmd_handle *tracecmd_open(int fd); 39struct tracecmd_input *tracecmd_open(int fd);
40int tracecmd_read_headers(struct tracecmd_handle *handle); 40int tracecmd_read_headers(struct tracecmd_input *handle);
41int tracecmd_long_size(struct tracecmd_handle *handle); 41int tracecmd_long_size(struct tracecmd_input *handle);
42int tracecmd_page_size(struct tracecmd_handle *handle); 42int tracecmd_page_size(struct tracecmd_input *handle);
43int tracecmd_cpus(struct tracecmd_handle *handle); 43int tracecmd_cpus(struct tracecmd_input *handle);
44 44
45int tracecmd_init_data(struct tracecmd_handle *handle); 45int tracecmd_init_data(struct tracecmd_input *handle);
46 46
47struct record * 47struct record *
48tracecmd_peek_data(struct tracecmd_handle *handle, int cpu); 48tracecmd_peek_data(struct tracecmd_input *handle, int cpu);
49 49
50struct record * 50struct record *
51tracecmd_read_data(struct tracecmd_handle *handle, int cpu); 51tracecmd_read_data(struct tracecmd_input *handle, int cpu);
52 52
53struct record * 53struct record *
54tracecmd_read_at(struct tracecmd_handle *handle, unsigned long long offset, 54tracecmd_read_at(struct tracecmd_input *handle, unsigned long long offset,
55 int *cpu); 55 int *cpu);
56struct record * 56struct record *
57tracecmd_translate_data(struct tracecmd_handle *handle, 57tracecmd_translate_data(struct tracecmd_input *handle,
58 void *ptr, int size); 58 void *ptr, int size);
59 59
60int tracecmd_ftrace_overrides(struct tracecmd_handle *handle); 60int tracecmd_ftrace_overrides(struct tracecmd_input *handle);
61struct pevent *tracecmd_get_pevent(struct tracecmd_handle *handle); 61struct pevent *tracecmd_get_pevent(struct tracecmd_input *handle);
62 62
63/* hack for function graph work around */ 63/* hack for function graph work around */
64extern __thread struct tracecmd_handle *tracecmd_curr_thread_handle; 64extern __thread struct tracecmd_input *tracecmd_curr_thread_handle;
65 65
66#endif /* _TRACE_CMD_H */ 66#endif /* _TRACE_CMD_H */
diff --git a/trace-ftrace.c b/trace-ftrace.c
index 3e7ccde..68ac7a8 100644
--- a/trace-ftrace.c
+++ b/trace-ftrace.c
@@ -289,7 +289,7 @@ fgraph_ret_handler(struct trace_seq *s, void *data, int size,
289 return trace_seq_putc(s, '}'); 289 return trace_seq_putc(s, '}');
290} 290}
291 291
292int tracecmd_ftrace_overrides(struct tracecmd_handle *handle) 292int tracecmd_ftrace_overrides(struct tracecmd_input *handle)
293{ 293{
294 struct pevent *pevent; 294 struct pevent *pevent;
295 struct event *event; 295 struct event *event;
diff --git a/trace-input.c b/trace-input.c
index 6e35897..23d4986 100644
--- a/trace-input.c
+++ b/trace-input.c
@@ -33,7 +33,7 @@ struct cpu_data {
33 int page_size; 33 int page_size;
34}; 34};
35 35
36struct tracecmd_handle { 36struct tracecmd_input {
37 struct pevent *pevent; 37 struct pevent *pevent;
38 int fd; 38 int fd;
39 int long_size; 39 int long_size;
@@ -44,11 +44,11 @@ struct tracecmd_handle {
44 struct cpu_data *cpu_data; 44 struct cpu_data *cpu_data;
45}; 45};
46 46
47__thread struct tracecmd_handle *tracecmd_curr_thread_handle; 47__thread struct tracecmd_input *tracecmd_curr_thread_handle;
48 48
49static int init_cpu(struct tracecmd_handle *handle, int cpu); 49static int init_cpu(struct tracecmd_input *handle, int cpu);
50 50
51static int do_read(struct tracecmd_handle *handle, void *data, int size) 51static int do_read(struct tracecmd_input *handle, void *data, int size)
52{ 52{
53 int tot = 0; 53 int tot = 0;
54 int r; 54 int r;
@@ -67,7 +67,7 @@ static int do_read(struct tracecmd_handle *handle, void *data, int size)
67} 67}
68 68
69static int 69static int
70do_read_check(struct tracecmd_handle *handle, void *data, int size) 70do_read_check(struct tracecmd_input *handle, void *data, int size)
71{ 71{
72 int ret; 72 int ret;
73 73
@@ -80,7 +80,7 @@ do_read_check(struct tracecmd_handle *handle, void *data, int size)
80 return 0; 80 return 0;
81} 81}
82 82
83static char *read_string(struct tracecmd_handle *handle) 83static char *read_string(struct tracecmd_input *handle)
84{ 84{
85 char buf[BUFSIZ]; 85 char buf[BUFSIZ];
86 char *str = NULL; 86 char *str = NULL;
@@ -146,7 +146,7 @@ static char *read_string(struct tracecmd_handle *handle)
146 return NULL; 146 return NULL;
147} 147}
148 148
149static unsigned int read4(struct tracecmd_handle *handle) 149static unsigned int read4(struct tracecmd_input *handle)
150{ 150{
151 struct pevent *pevent = handle->pevent; 151 struct pevent *pevent = handle->pevent;
152 unsigned int data; 152 unsigned int data;
@@ -157,7 +157,7 @@ static unsigned int read4(struct tracecmd_handle *handle)
157 return __data2host4(pevent, data); 157 return __data2host4(pevent, data);
158} 158}
159 159
160static unsigned long long read8(struct tracecmd_handle *handle) 160static unsigned long long read8(struct tracecmd_input *handle)
161{ 161{
162 struct pevent *pevent = handle->pevent; 162 struct pevent *pevent = handle->pevent;
163 unsigned long long data; 163 unsigned long long data;
@@ -168,7 +168,7 @@ static unsigned long long read8(struct tracecmd_handle *handle)
168 return __data2host8(pevent, data); 168 return __data2host8(pevent, data);
169} 169}
170 170
171static int read_header_files(struct tracecmd_handle *handle) 171static int read_header_files(struct tracecmd_input *handle)
172{ 172{
173 struct pevent *pevent = handle->pevent; 173 struct pevent *pevent = handle->pevent;
174 long long size; 174 long long size;
@@ -227,7 +227,7 @@ static int read_header_files(struct tracecmd_handle *handle)
227 return -1; 227 return -1;
228} 228}
229 229
230static int read_ftrace_file(struct tracecmd_handle *handle, 230static int read_ftrace_file(struct tracecmd_input *handle,
231 unsigned long long size) 231 unsigned long long size)
232{ 232{
233 struct pevent *pevent = handle->pevent; 233 struct pevent *pevent = handle->pevent;
@@ -247,7 +247,7 @@ static int read_ftrace_file(struct tracecmd_handle *handle,
247 return 0; 247 return 0;
248} 248}
249 249
250static int read_event_file(struct tracecmd_handle *handle, 250static int read_event_file(struct tracecmd_input *handle,
251 char *system, unsigned long long size) 251 char *system, unsigned long long size)
252{ 252{
253 struct pevent *pevent = handle->pevent; 253 struct pevent *pevent = handle->pevent;
@@ -271,7 +271,7 @@ static int read_event_file(struct tracecmd_handle *handle,
271 return 0; 271 return 0;
272} 272}
273 273
274static int read_ftrace_files(struct tracecmd_handle *handle) 274static int read_ftrace_files(struct tracecmd_input *handle)
275{ 275{
276 unsigned long long size; 276 unsigned long long size;
277 int count; 277 int count;
@@ -294,7 +294,7 @@ static int read_ftrace_files(struct tracecmd_handle *handle)
294 return 0; 294 return 0;
295} 295}
296 296
297static int read_event_files(struct tracecmd_handle *handle) 297static int read_event_files(struct tracecmd_input *handle)
298{ 298{
299 unsigned long long size; 299 unsigned long long size;
300 char *system; 300 char *system;
@@ -335,7 +335,7 @@ static int read_event_files(struct tracecmd_handle *handle)
335 return -1; 335 return -1;
336} 336}
337 337
338static int read_proc_kallsyms(struct tracecmd_handle *handle) 338static int read_proc_kallsyms(struct tracecmd_input *handle)
339{ 339{
340 struct pevent *pevent = handle->pevent; 340 struct pevent *pevent = handle->pevent;
341 int size; 341 int size;
@@ -362,7 +362,7 @@ static int read_proc_kallsyms(struct tracecmd_handle *handle)
362 return 0; 362 return 0;
363} 363}
364 364
365static int read_ftrace_printk(struct tracecmd_handle *handle) 365static int read_ftrace_printk(struct tracecmd_input *handle)
366{ 366{
367 int size; 367 int size;
368 char *buf; 368 char *buf;
@@ -389,7 +389,7 @@ static int read_ftrace_printk(struct tracecmd_handle *handle)
389 return 0; 389 return 0;
390} 390}
391 391
392int tracecmd_read_headers(struct tracecmd_handle *handle) 392int tracecmd_read_headers(struct tracecmd_input *handle)
393{ 393{
394 struct pevent *pevent = handle->pevent; 394 struct pevent *pevent = handle->pevent;
395 int ret; 395 int ret;
@@ -422,7 +422,7 @@ int tracecmd_read_headers(struct tracecmd_handle *handle)
422 return 0; 422 return 0;
423} 423}
424 424
425static unsigned int type4host(struct tracecmd_handle *handle, 425static unsigned int type4host(struct tracecmd_input *handle,
426 unsigned int type_len_ts) 426 unsigned int type_len_ts)
427{ 427{
428 struct pevent *pevent = handle->pevent; 428 struct pevent *pevent = handle->pevent;
@@ -433,7 +433,7 @@ static unsigned int type4host(struct tracecmd_handle *handle,
433 return type_len_ts & 3; 433 return type_len_ts & 3;
434} 434}
435 435
436static unsigned int len4host(struct tracecmd_handle *handle, 436static unsigned int len4host(struct tracecmd_input *handle,
437 unsigned int type_len_ts) 437 unsigned int type_len_ts)
438{ 438{
439 struct pevent *pevent = handle->pevent; 439 struct pevent *pevent = handle->pevent;
@@ -444,7 +444,7 @@ static unsigned int len4host(struct tracecmd_handle *handle,
444 return (type_len_ts >> 2) & 7; 444 return (type_len_ts >> 2) & 7;
445} 445}
446 446
447static unsigned int type_len4host(struct tracecmd_handle *handle, 447static unsigned int type_len4host(struct tracecmd_input *handle,
448 unsigned int type_len_ts) 448 unsigned int type_len_ts)
449{ 449{
450 struct pevent *pevent = handle->pevent; 450 struct pevent *pevent = handle->pevent;
@@ -455,7 +455,7 @@ static unsigned int type_len4host(struct tracecmd_handle *handle,
455 return type_len_ts & ((1 << 5) - 1); 455 return type_len_ts & ((1 << 5) - 1);
456} 456}
457 457
458static unsigned int ts4host(struct tracecmd_handle *handle, 458static unsigned int ts4host(struct tracecmd_input *handle,
459 unsigned int type_len_ts) 459 unsigned int type_len_ts)
460{ 460{
461 struct pevent *pevent = handle->pevent; 461 struct pevent *pevent = handle->pevent;
@@ -466,21 +466,21 @@ static unsigned int ts4host(struct tracecmd_handle *handle,
466 return type_len_ts >> 5; 466 return type_len_ts >> 5;
467} 467}
468 468
469static int calc_index(struct tracecmd_handle *handle, 469static int calc_index(struct tracecmd_input *handle,
470 void *ptr, int cpu) 470 void *ptr, int cpu)
471{ 471{
472 return (unsigned long)ptr - (unsigned long)handle->cpu_data[cpu].page; 472 return (unsigned long)ptr - (unsigned long)handle->cpu_data[cpu].page;
473} 473}
474 474
475static void 475static void
476update_cpu_data_index(struct tracecmd_handle *handle, int cpu) 476update_cpu_data_index(struct tracecmd_input *handle, int cpu)
477{ 477{
478 handle->cpu_data[cpu].offset += handle->page_size; 478 handle->cpu_data[cpu].offset += handle->page_size;
479 handle->cpu_data[cpu].size -= handle->page_size; 479 handle->cpu_data[cpu].size -= handle->page_size;
480 handle->cpu_data[cpu].index = 0; 480 handle->cpu_data[cpu].index = 0;
481} 481}
482 482
483static int get_next_page(struct tracecmd_handle *handle, int cpu) 483static int get_next_page(struct tracecmd_input *handle, int cpu)
484{ 484{
485 off64_t save_seek; 485 off64_t save_seek;
486 off64_t ret; 486 off64_t ret;
@@ -540,7 +540,7 @@ enum old_ring_buffer_type {
540}; 540};
541 541
542static struct record * 542static struct record *
543read_old_format(struct tracecmd_handle *handle, void **ptr, int cpu) 543read_old_format(struct tracecmd_input *handle, void **ptr, int cpu)
544{ 544{
545 struct pevent *pevent = handle->pevent; 545 struct pevent *pevent = handle->pevent;
546 struct record *data; 546 struct record *data;
@@ -614,7 +614,7 @@ read_old_format(struct tracecmd_handle *handle, void **ptr, int cpu)
614} 614}
615 615
616static struct record * 616static struct record *
617read_event(struct tracecmd_handle *handle, unsigned long long offset, 617read_event(struct tracecmd_input *handle, unsigned long long offset,
618 int cpu) 618 int cpu)
619{ 619{
620 struct record *record = NULL; 620 struct record *record = NULL;
@@ -645,7 +645,7 @@ read_event(struct tracecmd_handle *handle, unsigned long long offset,
645} 645}
646 646
647static struct record * 647static struct record *
648find_and_read_event(struct tracecmd_handle *handle, unsigned long long offset, 648find_and_read_event(struct tracecmd_input *handle, unsigned long long offset,
649 int *pcpu) 649 int *pcpu)
650{ 650{
651 unsigned long long page_offset; 651 unsigned long long page_offset;
@@ -707,7 +707,7 @@ find_and_read_event(struct tracecmd_handle *handle, unsigned long long offset,
707 707
708 708
709struct record * 709struct record *
710tracecmd_read_at(struct tracecmd_handle *handle, unsigned long long offset, 710tracecmd_read_at(struct tracecmd_input *handle, unsigned long long offset,
711 int *pcpu) 711 int *pcpu)
712{ 712{
713 unsigned long long page_offset; 713 unsigned long long page_offset;
@@ -730,7 +730,7 @@ tracecmd_read_at(struct tracecmd_handle *handle, unsigned long long offset,
730} 730}
731 731
732static unsigned int 732static unsigned int
733translate_data(struct tracecmd_handle *handle, 733translate_data(struct tracecmd_input *handle,
734 void **ptr, unsigned long long *delta, int *length) 734 void **ptr, unsigned long long *delta, int *length)
735{ 735{
736 struct pevent *pevent = handle->pevent; 736 struct pevent *pevent = handle->pevent;
@@ -777,7 +777,7 @@ translate_data(struct tracecmd_handle *handle,
777} 777}
778 778
779struct record * 779struct record *
780tracecmd_translate_data(struct tracecmd_handle *handle, 780tracecmd_translate_data(struct tracecmd_input *handle,
781 void *ptr, int size) 781 void *ptr, int size)
782{ 782{
783 struct record *data; 783 struct record *data;
@@ -808,7 +808,7 @@ tracecmd_translate_data(struct tracecmd_handle *handle,
808} 808}
809 809
810struct record * 810struct record *
811tracecmd_peek_data(struct tracecmd_handle *handle, int cpu) 811tracecmd_peek_data(struct tracecmd_input *handle, int cpu)
812{ 812{
813 struct pevent *pevent = handle->pevent; 813 struct pevent *pevent = handle->pevent;
814 struct record *data; 814 struct record *data;
@@ -913,7 +913,7 @@ read_again:
913} 913}
914 914
915struct record * 915struct record *
916tracecmd_read_data(struct tracecmd_handle *handle, int cpu) 916tracecmd_read_data(struct tracecmd_input *handle, int cpu)
917{ 917{
918 struct record *data; 918 struct record *data;
919 919
@@ -923,7 +923,7 @@ tracecmd_read_data(struct tracecmd_handle *handle, int cpu)
923 return data; 923 return data;
924} 924}
925 925
926static int init_read(struct tracecmd_handle *handle, int cpu) 926static int init_read(struct tracecmd_input *handle, int cpu)
927{ 927{
928 off64_t ret; 928 off64_t ret;
929 off64_t save_seek; 929 off64_t save_seek;
@@ -948,7 +948,7 @@ static int init_read(struct tracecmd_handle *handle, int cpu)
948 return 0; 948 return 0;
949} 949}
950 950
951static int init_cpu(struct tracecmd_handle *handle, int cpu) 951static int init_cpu(struct tracecmd_input *handle, int cpu)
952{ 952{
953 if (!handle->cpu_data[cpu].size) { 953 if (!handle->cpu_data[cpu].size) {
954 printf("CPU %d is empty\n", cpu); 954 printf("CPU %d is empty\n", cpu);
@@ -971,7 +971,7 @@ static int init_cpu(struct tracecmd_handle *handle, int cpu)
971 return 0; 971 return 0;
972} 972}
973 973
974int tracecmd_init_data(struct tracecmd_handle *handle) 974int tracecmd_init_data(struct tracecmd_input *handle)
975{ 975{
976 struct pevent *pevent = handle->pevent; 976 struct pevent *pevent = handle->pevent;
977 unsigned long long size; 977 unsigned long long size;
@@ -1032,9 +1032,9 @@ int tracecmd_init_data(struct tracecmd_handle *handle)
1032 return 0; 1032 return 0;
1033} 1033}
1034 1034
1035struct tracecmd_handle *tracecmd_open(int fd) 1035struct tracecmd_input *tracecmd_open(int fd)
1036{ 1036{
1037 struct tracecmd_handle *handle; 1037 struct tracecmd_input *handle;
1038 char test[] = { 23, 8, 68 }; 1038 char test[] = { 23, 8, 68 };
1039 char *version; 1039 char *version;
1040 char buf[BUFSIZ]; 1040 char buf[BUFSIZ];
@@ -1086,22 +1086,22 @@ struct tracecmd_handle *tracecmd_open(int fd)
1086 return NULL; 1086 return NULL;
1087} 1087}
1088 1088
1089int tracecmd_long_size(struct tracecmd_handle *handle) 1089int tracecmd_long_size(struct tracecmd_input *handle)
1090{ 1090{
1091 return handle->long_size; 1091 return handle->long_size;
1092} 1092}
1093 1093
1094int tracecmd_page_size(struct tracecmd_handle *handle) 1094int tracecmd_page_size(struct tracecmd_input *handle)
1095{ 1095{
1096 return handle->page_size; 1096 return handle->page_size;
1097} 1097}
1098 1098
1099int tracecmd_cpus(struct tracecmd_handle *handle) 1099int tracecmd_cpus(struct tracecmd_input *handle)
1100{ 1100{
1101 return handle->cpus; 1101 return handle->cpus;
1102} 1102}
1103 1103
1104struct pevent *tracecmd_get_pevent(struct tracecmd_handle *handle) 1104struct pevent *tracecmd_get_pevent(struct tracecmd_input *handle)
1105{ 1105{
1106 return handle->pevent; 1106 return handle->pevent;
1107} 1107}
diff --git a/trace-local.h b/trace-local.h
index 83fe077..2fab032 100644
--- a/trace-local.h
+++ b/trace-local.h
@@ -7,7 +7,7 @@
7 7
8void usage(char **argv); 8void usage(char **argv);
9 9
10struct tracecmd_handle *read_trace_header(void); 10struct tracecmd_input *read_trace_header(void);
11int read_trace_files(void); 11int read_trace_files(void);
12 12
13void trace_report(int argc, char **argv); 13void trace_report(int argc, char **argv);
diff --git a/trace-read.c b/trace-read.c
index 862200f..9bc7f60 100644
--- a/trace-read.c
+++ b/trace-read.c
@@ -46,7 +46,7 @@ int show_events = 0;
46 46
47static int filter_cpu = -1; 47static int filter_cpu = -1;
48 48
49static void show_data(struct tracecmd_handle *handle, int cpu) 49static void show_data(struct tracecmd_input *handle, int cpu)
50{ 50{
51 struct pevent *pevent; 51 struct pevent *pevent;
52 struct record *record; 52 struct record *record;
@@ -78,7 +78,7 @@ static void read_rest(void)
78 } while (r > 0); 78 } while (r > 0);
79} 79}
80 80
81static void read_data_info(struct tracecmd_handle *handle) 81static void read_data_info(struct tracecmd_input *handle)
82{ 82{
83 unsigned long long ts; 83 unsigned long long ts;
84 struct record *data; 84 struct record *data;
@@ -123,7 +123,7 @@ static void read_data_info(struct tracecmd_handle *handle)
123 } while (next >= 0); 123 } while (next >= 0);
124} 124}
125 125
126struct tracecmd_handle *read_trace_header(void) 126struct tracecmd_input *read_trace_header(void)
127{ 127{
128 input_fd = open(input_file, O_RDONLY); 128 input_fd = open(input_file, O_RDONLY);
129 if (input_fd < 0) 129 if (input_fd < 0)
@@ -134,7 +134,7 @@ struct tracecmd_handle *read_trace_header(void)
134 134
135void trace_report (int argc, char **argv) 135void trace_report (int argc, char **argv)
136{ 136{
137 struct tracecmd_handle *handle; 137 struct tracecmd_input *handle;
138 struct pevent *pevent; 138 struct pevent *pevent;
139 int show_funcs = 0; 139 int show_funcs = 0;
140 int show_endian = 0; 140 int show_endian = 0;