diff options
author | Kan Liang <kan.liang@intel.com> | 2014-10-07 11:08:49 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-10-15 15:04:33 -0400 |
commit | 42f60c2d63b0d3f7230d28ac37c1da4885d4ee65 (patch) | |
tree | 1bf548cb6295e696b5279dfdf9f7bf893b849b3d | |
parent | b56d5beff4825f9f216f1fc4a54a5d07d4b68b71 (diff) |
Revert "perf tools: Default to cpu// for events v5"
This reverts commit 50e200f07948 ("perf tools: Default to cpu// for
events v5")
The fixup cannot handle the case that
new style format(which without //) mixed with
other different formats.
For example,
group events with new style format: {mem-stores,mem-loads}
some hardware event + new style event: cycles,mem-loads
Cache event + new style event: LLC-loads,mem-loads
Raw event + new style event:
cpu/event=0xc8,umask=0x08/,mem-loads
old style event and new stytle mixture: mem-stores,cpu/mem-loads/
Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1412694532-23391-2-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/include/linux/string.h | 1 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 30 | ||||
-rw-r--r-- | tools/perf/util/string.c | 24 |
3 files changed, 1 insertions, 54 deletions
diff --git a/tools/perf/util/include/linux/string.h b/tools/perf/util/include/linux/string.h index 97a800738226..6f19c548ecc0 100644 --- a/tools/perf/util/include/linux/string.h +++ b/tools/perf/util/include/linux/string.h | |||
@@ -1,4 +1,3 @@ | |||
1 | #include <string.h> | 1 | #include <string.h> |
2 | 2 | ||
3 | void *memdup(const void *src, size_t len); | 3 | void *memdup(const void *src, size_t len); |
4 | int str_append(char **s, int *len, const char *a); | ||
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index d76aa30cb1fb..c5642e6748b2 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -6,7 +6,7 @@ | |||
6 | #include "parse-options.h" | 6 | #include "parse-options.h" |
7 | #include "parse-events.h" | 7 | #include "parse-events.h" |
8 | #include "exec_cmd.h" | 8 | #include "exec_cmd.h" |
9 | #include "linux/string.h" | 9 | #include "string.h" |
10 | #include "symbol.h" | 10 | #include "symbol.h" |
11 | #include "cache.h" | 11 | #include "cache.h" |
12 | #include "header.h" | 12 | #include "header.h" |
@@ -863,32 +863,6 @@ int parse_events_name(struct list_head *list, char *name) | |||
863 | return 0; | 863 | return 0; |
864 | } | 864 | } |
865 | 865 | ||
866 | static int parse_events__scanner(const char *str, void *data, int start_token); | ||
867 | |||
868 | static int parse_events_fixup(int ret, const char *str, void *data, | ||
869 | int start_token) | ||
870 | { | ||
871 | char *o = strdup(str); | ||
872 | char *s = NULL; | ||
873 | char *t = o; | ||
874 | char *p; | ||
875 | int len = 0; | ||
876 | |||
877 | if (!o) | ||
878 | return ret; | ||
879 | while ((p = strsep(&t, ",")) != NULL) { | ||
880 | if (s) | ||
881 | str_append(&s, &len, ","); | ||
882 | str_append(&s, &len, "cpu/"); | ||
883 | str_append(&s, &len, p); | ||
884 | str_append(&s, &len, "/"); | ||
885 | } | ||
886 | free(o); | ||
887 | if (!s) | ||
888 | return -ENOMEM; | ||
889 | return parse_events__scanner(s, data, start_token); | ||
890 | } | ||
891 | |||
892 | static int parse_events__scanner(const char *str, void *data, int start_token) | 866 | static int parse_events__scanner(const char *str, void *data, int start_token) |
893 | { | 867 | { |
894 | YY_BUFFER_STATE buffer; | 868 | YY_BUFFER_STATE buffer; |
@@ -909,8 +883,6 @@ static int parse_events__scanner(const char *str, void *data, int start_token) | |||
909 | parse_events__flush_buffer(buffer, scanner); | 883 | parse_events__flush_buffer(buffer, scanner); |
910 | parse_events__delete_buffer(buffer, scanner); | 884 | parse_events__delete_buffer(buffer, scanner); |
911 | parse_events_lex_destroy(scanner); | 885 | parse_events_lex_destroy(scanner); |
912 | if (ret && !strchr(str, '/')) | ||
913 | ret = parse_events_fixup(ret, str, data, start_token); | ||
914 | return ret; | 886 | return ret; |
915 | } | 887 | } |
916 | 888 | ||
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c index d87767f76903..6afd6106ceb5 100644 --- a/tools/perf/util/string.c +++ b/tools/perf/util/string.c | |||
@@ -357,27 +357,3 @@ void *memdup(const void *src, size_t len) | |||
357 | 357 | ||
358 | return p; | 358 | return p; |
359 | } | 359 | } |
360 | |||
361 | /** | ||
362 | * str_append - reallocate string and append another | ||
363 | * @s: pointer to string pointer | ||
364 | * @len: pointer to len (initialized) | ||
365 | * @a: string to append. | ||
366 | */ | ||
367 | int str_append(char **s, int *len, const char *a) | ||
368 | { | ||
369 | int olen = *s ? strlen(*s) : 0; | ||
370 | int nlen = olen + strlen(a) + 1; | ||
371 | if (*len < nlen) { | ||
372 | *len = *len * 2; | ||
373 | if (*len < nlen) | ||
374 | *len = nlen; | ||
375 | *s = realloc(*s, *len); | ||
376 | if (!*s) | ||
377 | return -ENOMEM; | ||
378 | if (olen == 0) | ||
379 | **s = 0; | ||
380 | } | ||
381 | strcat(*s, a); | ||
382 | return 0; | ||
383 | } | ||