aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2012-09-08 07:26:02 -0400
committerIngo Molnar <mingo@kernel.org>2012-09-08 07:26:02 -0400
commitef34eb4da3eb62a1511592adf7c76d74faca0b14 (patch)
tree7f28887cf8c5d7059416769e152e79f68ce32830 /tools
parent479d875835a49e849683743ec50c30b6a429696b (diff)
parentb155a09015135cf59ada8d48109ccbd9891c1b42 (diff)
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo: * Fix build for another rbtree.c change, from Adrian Hunter. * Fixes for perf to build on Android, from Irina Tirdea. * Make 'perf diff' command work with evsel hists, from Jiri Olsa. * Use the only field_sep var that is set up: symbol_conf.field_sep, fix from Jiri Olsa. * .gitignore compiled python binaries, from Namhyung Kim. * Get rid of die() in more libtraceevent places, from Namhyung Kim. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/traceevent/event-parse.c86
-rw-r--r--tools/lib/traceevent/event-parse.h3
-rw-r--r--tools/perf/.gitignore2
-rw-r--r--tools/perf/Documentation/perf-diff.txt3
-rw-r--r--tools/perf/Makefile8
-rw-r--r--tools/perf/builtin-diff.c93
-rw-r--r--tools/perf/config/feature-tests.mak14
-rw-r--r--tools/perf/perf.c1
-rw-r--r--tools/perf/util/annotate.h1
-rw-r--r--tools/perf/util/dso-test-data.c2
-rw-r--r--tools/perf/util/evsel.h7
-rw-r--r--tools/perf/util/help.c1
-rw-r--r--tools/perf/util/include/linux/rbtree.h1
-rw-r--r--tools/perf/util/session.h4
-rw-r--r--tools/perf/util/sort.c6
-rw-r--r--tools/perf/util/sort.h1
-rw-r--r--tools/perf/util/symbol.h3
-rw-r--r--tools/perf/util/top.h1
-rw-r--r--tools/perf/util/util.c6
19 files changed, 180 insertions, 63 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index b5b4d806ffa..f4190b5764d 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -3889,8 +3889,11 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
3889 goto cont_process; 3889 goto cont_process;
3890 case '*': 3890 case '*':
3891 /* The argument is the length. */ 3891 /* The argument is the length. */
3892 if (!arg) 3892 if (!arg) {
3893 die("no argument match"); 3893 do_warning("no argument match");
3894 event->flags |= EVENT_FL_FAILED;
3895 goto out_failed;
3896 }
3894 len_arg = eval_num_arg(data, size, event, arg); 3897 len_arg = eval_num_arg(data, size, event, arg);
3895 len_as_arg = 1; 3898 len_as_arg = 1;
3896 arg = arg->next; 3899 arg = arg->next;
@@ -3923,15 +3926,21 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
3923 case 'x': 3926 case 'x':
3924 case 'X': 3927 case 'X':
3925 case 'u': 3928 case 'u':
3926 if (!arg) 3929 if (!arg) {
3927 die("no argument match"); 3930 do_warning("no argument match");
3931 event->flags |= EVENT_FL_FAILED;
3932 goto out_failed;
3933 }
3928 3934
3929 len = ((unsigned long)ptr + 1) - 3935 len = ((unsigned long)ptr + 1) -
3930 (unsigned long)saveptr; 3936 (unsigned long)saveptr;
3931 3937
3932 /* should never happen */ 3938 /* should never happen */
3933 if (len > 31) 3939 if (len > 31) {
3934 die("bad format!"); 3940 do_warning("bad format!");
3941 event->flags |= EVENT_FL_FAILED;
3942 len = 31;
3943 }
3935 3944
3936 memcpy(format, saveptr, len); 3945 memcpy(format, saveptr, len);
3937 format[len] = 0; 3946 format[len] = 0;
@@ -3995,19 +4004,26 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
3995 trace_seq_printf(s, format, (long long)val); 4004 trace_seq_printf(s, format, (long long)val);
3996 break; 4005 break;
3997 default: 4006 default:
3998 die("bad count (%d)", ls); 4007 do_warning("bad count (%d)", ls);
4008 event->flags |= EVENT_FL_FAILED;
3999 } 4009 }
4000 break; 4010 break;
4001 case 's': 4011 case 's':
4002 if (!arg) 4012 if (!arg) {
4003 die("no matching argument"); 4013 do_warning("no matching argument");
4014 event->flags |= EVENT_FL_FAILED;
4015 goto out_failed;
4016 }
4004 4017
4005 len = ((unsigned long)ptr + 1) - 4018 len = ((unsigned long)ptr + 1) -
4006 (unsigned long)saveptr; 4019 (unsigned long)saveptr;
4007 4020
4008 /* should never happen */ 4021 /* should never happen */
4009 if (len > 31) 4022 if (len > 31) {
4010 die("bad format!"); 4023 do_warning("bad format!");
4024 event->flags |= EVENT_FL_FAILED;
4025 len = 31;
4026 }
4011 4027
4012 memcpy(format, saveptr, len); 4028 memcpy(format, saveptr, len);
4013 format[len] = 0; 4029 format[len] = 0;
@@ -4025,6 +4041,11 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
4025 trace_seq_putc(s, *ptr); 4041 trace_seq_putc(s, *ptr);
4026 } 4042 }
4027 4043
4044 if (event->flags & EVENT_FL_FAILED) {
4045out_failed:
4046 trace_seq_printf(s, "[FAILED TO PARSE]");
4047 }
4048
4028 if (args) { 4049 if (args) {
4029 free_args(args); 4050 free_args(args);
4030 free(bprint_fmt); 4051 free(bprint_fmt);
@@ -4812,8 +4833,8 @@ int pevent_strerror(struct pevent *pevent, enum pevent_errno errnum,
4812 msg = strerror_r(errnum, buf, buflen); 4833 msg = strerror_r(errnum, buf, buflen);
4813 if (msg != buf) { 4834 if (msg != buf) {
4814 size_t len = strlen(msg); 4835 size_t len = strlen(msg);
4815 char *c = mempcpy(buf, msg, min(buflen-1, len)); 4836 memcpy(buf, msg, min(buflen - 1, len));
4816 *c = '\0'; 4837 *(buf + min(buflen - 1, len)) = '\0';
4817 } 4838 }
4818 return 0; 4839 return 0;
4819 } 4840 }
@@ -5059,6 +5080,7 @@ int pevent_register_print_function(struct pevent *pevent,
5059 struct pevent_func_params *param; 5080 struct pevent_func_params *param;
5060 enum pevent_func_arg_type type; 5081 enum pevent_func_arg_type type;
5061 va_list ap; 5082 va_list ap;
5083 int ret;
5062 5084
5063 func_handle = find_func_handler(pevent, name); 5085 func_handle = find_func_handler(pevent, name);
5064 if (func_handle) { 5086 if (func_handle) {
@@ -5071,14 +5093,21 @@ int pevent_register_print_function(struct pevent *pevent,
5071 remove_func_handler(pevent, name); 5093 remove_func_handler(pevent, name);
5072 } 5094 }
5073 5095
5074 func_handle = malloc_or_die(sizeof(*func_handle)); 5096 func_handle = malloc(sizeof(*func_handle));
5097 if (!func_handle) {
5098 do_warning("Failed to allocate function handler");
5099 return PEVENT_ERRNO__MEM_ALLOC_FAILED;
5100 }
5075 memset(func_handle, 0, sizeof(*func_handle)); 5101 memset(func_handle, 0, sizeof(*func_handle));
5076 5102
5077 func_handle->ret_type = ret_type; 5103 func_handle->ret_type = ret_type;
5078 func_handle->name = strdup(name); 5104 func_handle->name = strdup(name);
5079 func_handle->func = func; 5105 func_handle->func = func;
5080 if (!func_handle->name) 5106 if (!func_handle->name) {
5081 die("Failed to allocate function name"); 5107 do_warning("Failed to allocate function name");
5108 free(func_handle);
5109 return PEVENT_ERRNO__MEM_ALLOC_FAILED;
5110 }
5082 5111
5083 next_param = &(func_handle->params); 5112 next_param = &(func_handle->params);
5084 va_start(ap, name); 5113 va_start(ap, name);
@@ -5088,11 +5117,17 @@ int pevent_register_print_function(struct pevent *pevent,
5088 break; 5117 break;
5089 5118
5090 if (type < 0 || type >= PEVENT_FUNC_ARG_MAX_TYPES) { 5119 if (type < 0 || type >= PEVENT_FUNC_ARG_MAX_TYPES) {
5091 warning("Invalid argument type %d", type); 5120 do_warning("Invalid argument type %d", type);
5121 ret = PEVENT_ERRNO__INVALID_ARG_TYPE;
5092 goto out_free; 5122 goto out_free;
5093 } 5123 }
5094 5124