aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2012-04-05 18:47:55 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2012-04-25 07:12:26 -0400
commit668fe01f1cea2154da479dd12946eeb53413396e (patch)
treea3c4f8bc431c61fde7a136d88c45538893bff829 /tools
parentd0e7b850b7d45ff86868e7df4eb1f3cdd283f776 (diff)
events: Update tools/lib/traceevent to work with perf
Some of the util functions of libtraceevent.a conflict with perf, such as die(), warning() and others. Move them into event-util.h that is not included by the perf tools. Also, as perf compiles with 'bool' the filter_arg->bool needs to be renamed to filter_arg->boolean. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Arun Sharma <asharma@fb.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/traceevent/event-parse.c1
-rw-r--r--tools/lib/traceevent/event-parse.h20
-rw-r--r--tools/lib/traceevent/event-utils.h16
-rw-r--r--tools/lib/traceevent/parse-filter.c32
-rw-r--r--tools/lib/traceevent/trace-seq.c1
5 files changed, 37 insertions, 33 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 47a3227e98b4..3ce75b5d7612 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -33,6 +33,7 @@
33#include <errno.h> 33#include <errno.h>
34 34
35#include "event-parse.h" 35#include "event-parse.h"
36#include "event-utils.h"
36 37
37static const char *input_buf; 38static const char *input_buf;
38static unsigned long long input_buf_ptr; 39static unsigned long long input_buf_ptr;
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index c32d7153a8d6..2e0222dd3a8b 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -167,6 +167,8 @@ enum format_flags {
167 FIELD_IS_STRING = 8, 167 FIELD_IS_STRING = 8,
168 FIELD_IS_DYNAMIC = 16, 168 FIELD_IS_DYNAMIC = 16,
169 FIELD_IS_LONG = 32, 169 FIELD_IS_LONG = 32,
170 FIELD_IS_FLAG = 64,
171 FIELD_IS_SYMBOLIC = 128,
170}; 172};
171 173
172struct format_field { 174struct format_field {
@@ -406,22 +408,6 @@ struct pevent {
406 struct event_format *last_event; 408 struct event_format *last_event;
407}; 409};
408 410
409/* Can be overridden */
410void die(const char *fmt, ...);
411void *malloc_or_die(unsigned int size);
412void warning(const char *fmt, ...);
413void pr_stat(const char *fmt, ...);
414void vpr_stat(const char *fmt, va_list ap);
415
416/* Always available */
417void __die(const char *fmt, ...);
418void __warning(const char *fmt, ...);
419void __pr_stat(const char *fmt, ...);
420
421void __vdie(const char *fmt, ...);
422void __vwarning(const char *fmt, ...);
423void __vpr_stat(const char *fmt, ...);
424
425static inline unsigned short 411static inline unsigned short
426__data2host2(struct pevent *pevent, unsigned short data) 412__data2host2(struct pevent *pevent, unsigned short data)
427{ 413{
@@ -734,7 +720,7 @@ struct filter_arg_str {
734struct filter_arg { 720struct filter_arg {
735 enum filter_arg_type type; 721 enum filter_arg_type type;
736 union { 722 union {
737 struct filter_arg_boolean bool; 723 struct filter_arg_boolean boolean;
738 struct filter_arg_field field; 724 struct filter_arg_field field;
739 struct filter_arg_value value; 725 struct filter_arg_value value;
740 struct filter_arg_op op; 726 struct filter_arg_op op;
diff --git a/tools/lib/traceevent/event-utils.h b/tools/lib/traceevent/event-utils.h
index a8fb48f19224..08296383d1e6 100644
--- a/tools/lib/traceevent/event-utils.h
+++ b/tools/lib/traceevent/event-utils.h
@@ -23,6 +23,22 @@
23 23
24#include <ctype.h> 24#include <ctype.h>
25 25
26/* Can be overridden */
27void die(const char *fmt, ...);
28void *malloc_or_die(unsigned int size);
29void warning(const char *fmt, ...);
30void pr_stat(const char *fmt, ...);
31void vpr_stat(const char *fmt, va_list ap);
32
33/* Always available */
34void __die(const char *fmt, ...);
35void __warning(const char *fmt, ...);
36void __pr_stat(const char *fmt, ...);
37
38void __vdie(const char *fmt, ...);
39void __vwarning(const char *fmt, ...);
40void __vpr_stat(const char *fmt, ...);
41
26static inline char *strim(char *string) 42static inline char *strim(char *string)
27{ 43{
28 char *ret; 44 char *ret;
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index 1df9966dff60..fe371828af6c 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -359,7 +359,7 @@ create_arg_item(struct event_format *event,
359 if (strcmp(token, COMM) != 0) { 359 if (strcmp(token, COMM) != 0) {
360 /* not a field, Make it false */ 360 /* not a field, Make it false */
361 arg->type = FILTER_ARG_BOOLEAN; 361 arg->type = FILTER_ARG_BOOLEAN;
362 arg->bool.value = FILTER_FALSE; 362 arg->boolean.value = FILTER_FALSE;
363 break; 363 break;
364 } 364 }
365 /* If token is 'COMM' then it is special */ 365 /* If token is 'COMM' then it is special */
@@ -487,7 +487,7 @@ static int add_right(struct filter_arg *op, struct filter_arg *arg,
487 free_arg(left); 487 free_arg(left);
488 free_arg(arg); 488 free_arg(arg);
489 op->type = FILTER_ARG_BOOLEAN; 489 op->type = FILTER_ARG_BOOLEAN;
490 op->bool.value = FILTER_FALSE; 490 op->boolean.value = FILTER_FALSE;
491 break; 491 break;
492 } 492 }
493 493
@@ -772,7 +772,7 @@ enum filter_vals test_arg(struct filter_arg *parent, struct filter_arg *arg)
772 772
773 /* bad case */ 773 /* bad case */
774 case FILTER_ARG_BOOLEAN: 774 case FILTER_ARG_BOOLEAN:
775 return FILTER_VAL_FALSE + arg->bool.value; 775 return FILTER_VAL_FALSE + arg->boolean.value;
776 776
777 /* good cases: */ 777 /* good cases: */
778 case FILTER_ARG_STR: 778 case FILTER_ARG_STR:
@@ -871,7 +871,7 @@ static struct filter_arg *collapse_tree(struct filter_arg *arg)
871 free_arg(arg); 871 free_arg(arg);
872 arg = allocate_arg(); 872 arg = allocate_arg();
873 arg->type = FILTER_ARG_BOOLEAN; 873 arg->type = FILTER_ARG_BOOLEAN;
874 arg->bool.value = ret == FILTER_VAL_TRUE; 874 arg->boolean.value = ret == FILTER_VAL_TRUE;
875 } 875 }
876 876
877 return arg; 877 return arg;
@@ -1116,7 +1116,7 @@ process_event(struct event_format *event, const char *filter_str,
1116 if (!*parg) { 1116 if (!*parg) {
1117 *parg = allocate_arg(); 1117 *parg = allocate_arg();
1118 (*parg)->type = FILTER_ARG_BOOLEAN; 1118 (*parg)->type = FILTER_ARG_BOOLEAN;
1119 (*parg)->bool.value = FILTER_FALSE; 1119 (*parg)->boolean.value = FILTER_FALSE;
1120 } 1120 }
1121 1121
1122 return 0; 1122 return 0;
@@ -1139,7 +1139,7 @@ static int filter_event(struct event_filter *filter,
1139 /* just add a TRUE arg */ 1139 /* just add a TRUE arg */
1140 arg = allocate_arg(); 1140 arg = allocate_arg();
1141 arg->type = FILTER_ARG_BOOLEAN; 1141 arg->type = FILTER_ARG_BOOLEAN;
1142 arg->bool.value = FILTER_TRUE; 1142 arg->boolean.value = FILTER_TRUE;
1143 } 1143 }
1144 1144
1145 filter_type = add_filter_type(filter, event->id); 1145 filter_type = add_filter_type(filter, event->id);
@@ -1369,9 +1369,9 @@ static int copy_filter_type(struct event_filter *filter,
1369 arg = allocate_arg(); 1369 arg = allocate_arg();
1370 arg->type = FILTER_ARG_BOOLEAN; 1370 arg->type = FILTER_ARG_BOOLEAN;
1371 if (strcmp(str, "TRUE") == 0) 1371 if (strcmp(str, "TRUE") == 0)
1372 arg->bool.value = 1; 1372 arg->boolean.value = 1;
1373 else 1373 else
1374 arg->bool.value = 0; 1374 arg->boolean.value = 0;
1375 1375
1376 filter_type = add_filter_type(filter, event->id); 1376 filter_type = add_filter_type(filter, event->id);
1377 filter_type->filter = arg; 1377 filter_type->filter = arg;
@@ -1442,8 +1442,8 @@ int pevent_update_trivial(struct event_filter *dest, struct event_filter *source
1442 arg = filter_type->filter; 1442 arg = filter_type->filter;
1443 if (arg->type != FILTER_ARG_BOOLEAN) 1443 if (arg->type != FILTER_ARG_BOOLEAN)
1444 continue; 1444 continue;
1445 if ((arg->bool.value && type == FILTER_TRIVIAL_FALSE) || 1445 if ((arg->boolean.value && type == FILTER_TRIVIAL_FALSE) ||
1446 (!arg->bool.value && type == FILTER_TRIVIAL_TRUE)) 1446 (!arg->boolean.value && type == FILTER_TRIVIAL_TRUE))
1447 continue; 1447 continue;
1448 1448
1449 event = filter_type->event; 1449 event = filter_type->event;
@@ -1497,10 +1497,10 @@ void pevent_filter_clear_trivial(struct event_filter *filter,
1497 continue; 1497 continue;
1498 switch (type) { 1498 switch (type) {
1499 case FILTER_TRIVIAL_FALSE: 1499 case FILTER_TRIVIAL_FALSE:
1500 if (filter_type->filter->bool.value) 1500 if (filter_type->filter->boolean.value)
1501 continue; 1501 continue;
1502 case FILTER_TRIVIAL_TRUE: 1502 case FILTER_TRIVIAL_TRUE:
1503 if (!filter_type->filter->bool.value) 1503 if (!filter_type->filter->boolean.value)
1504 continue; 1504 continue;
1505 default: 1505 default:
1506 break; 1506 break;
@@ -1551,10 +1551,10 @@ int pevent_filter_event_has_trivial(struct event_filter *filter,
1551 1551
1552 switch (type) { 1552 switch (type) {
1553 case FILTER_TRIVIAL_FALSE: 1553 case FILTER_TRIVIAL_FALSE:
1554 return !filter_type->filter->bool.value; 1554 return !filter_type->filter->boolean.value;
1555 1555
1556 case FILTER_TRIVIAL_TRUE: 1556 case FILTER_TRIVIAL_TRUE:
1557 return filter_type->filter->bool.value; 1557 return filter_type->filter->boolean.value;
1558 default: 1558 default:
1559 return 1; 1559 return 1;
1560 } 1560 }
@@ -1783,7 +1783,7 @@ static int test_filter(struct event_format *event,
1783 switch (arg->type) { 1783 switch (arg->type) {
1784 case FILTER_ARG_BOOLEAN: 1784 case FILTER_ARG_BOOLEAN:
1785 /* easy case */ 1785 /* easy case */
1786 return arg->bool.value; 1786 return arg->boolean.value;
1787 1787
1788 case FILTER_ARG_OP: 1788 case FILTER_ARG_OP:
1789 return test_op(event, arg, record); 1789 return test_op(event, arg, record);
@@ -2147,7 +2147,7 @@ static char *arg_to_str(struct event_filter *filter, struct filter_arg *arg)
2147 switch (arg->type) { 2147 switch (arg->type) {
2148 case FILTER_ARG_BOOLEAN: 2148 case FILTER_ARG_BOOLEAN:
2149 str = malloc_or_die(6); 2149 str = malloc_or_die(6);
2150 if (arg->bool.value) 2150 if (arg->boolean.value)
2151 strcpy(str, "TRUE"); 2151 strcpy(str, "TRUE");
2152 else 2152 else
2153 strcpy(str, "FALSE"); 2153 strcpy(str, "FALSE");
diff --git a/tools/lib/traceevent/trace-seq.c b/tools/lib/traceevent/trace-seq.c
index d2f265b48cde..b1ccc923e8a5 100644
--- a/tools/lib/traceevent/trace-seq.c
+++ b/tools/lib/traceevent/trace-seq.c
@@ -24,6 +24,7 @@
24#include <stdarg.h> 24#include <stdarg.h>
25 25
26#include "event-parse.h" 26#include "event-parse.h"
27#include "event-utils.h"
27 28
28/* 29/*
29 * The TRACE_SEQ_POISON is to catch the use of using 30 * The TRACE_SEQ_POISON is to catch the use of using