diff options
author | Irina Tirdea <irina.tirdea@gmail.com> | 2012-09-10 18:15:03 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-09-11 11:19:15 -0400 |
commit | 1d037ca1648b775277fc96401ec2aa233724906c (patch) | |
tree | 266722dc6c9e00c67c66f5f8d06f30d0c2dd3979 /tools/perf/builtin-stat.c | |
parent | 7dbf4dcfe2987c35c2c4675cd7ae1b6006979176 (diff) |
perf tools: Use __maybe_used for unused variables
perf defines both __used and __unused variables to use for marking
unused variables. The variable __used is defined to
__attribute__((__unused__)), which contradicts the kernel definition to
__attribute__((__used__)) for new gcc versions. On Android, __used is
also defined in system headers and this leads to warnings like: warning:
'__used__' attribute ignored
__unused is not defined in the kernel and is not a standard definition.
If __unused is included everywhere instead of __used, this leads to
conflicts with glibc headers, since glibc has a variables with this name
in its headers.
The best approach is to use __maybe_unused, the definition used in the
kernel for __attribute__((unused)). In this way there is only one
definition in perf sources (instead of 2 definitions that point to the
same thing: __used and __unused) and it works on both Linux and Android.
This patch simply replaces all instances of __used and __unused with
__maybe_unused.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Acked-by: Pekka Enberg <penberg@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1347315303-29906-7-git-send-email-irina.tirdea@intel.com
[ committer note: fixed up conflict with a116e05 in builtin-sched.c ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-stat.c')
-rw-r--r-- | tools/perf/builtin-stat.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 02f49eba677..dab347d7b01 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -417,7 +417,7 @@ static int read_counter(struct perf_evsel *counter) | |||
417 | return 0; | 417 | return 0; |
418 | } | 418 | } |
419 | 419 | ||
420 | static int run_perf_stat(int argc __used, const char **argv) | 420 | static int run_perf_stat(int argc __maybe_unused, const char **argv) |
421 | { | 421 | { |
422 | unsigned long long t0, t1; | 422 | unsigned long long t0, t1; |
423 | struct perf_evsel *counter, *first; | 423 | struct perf_evsel *counter, *first; |
@@ -634,7 +634,9 @@ static const char *get_ratio_color(enum grc_type type, double ratio) | |||
634 | return color; | 634 | return color; |
635 | } | 635 | } |
636 | 636 | ||
637 | static void print_stalled_cycles_frontend(int cpu, struct perf_evsel *evsel __used, double avg) | 637 | static void print_stalled_cycles_frontend(int cpu, |
638 | struct perf_evsel *evsel | ||
639 | __maybe_unused, double avg) | ||
638 | { | 640 | { |
639 | double total, ratio = 0.0; | 641 | double total, ratio = 0.0; |
640 | const char *color; | 642 | const char *color; |
@@ -651,7 +653,9 @@ static void print_stalled_cycles_frontend(int cpu, struct perf_evsel *evsel __us | |||
651 | fprintf(output, " frontend cycles idle "); | 653 | fprintf(output, " frontend cycles idle "); |
652 | } | 654 | } |
653 | 655 | ||
654 | static void print_stalled_cycles_backend(int cpu, struct perf_evsel *evsel __used, double avg) | 656 | static void print_stalled_cycles_backend(int cpu, |
657 | struct perf_evsel *evsel | ||
658 | __maybe_unused, double avg) | ||
655 | { | 659 | { |
656 | double total, ratio = 0.0; | 660 | double total, ratio = 0.0; |
657 | const char *color; | 661 | const char *color; |
@@ -668,7 +672,9 @@ static void print_stalled_cycles_backend(int cpu, struct perf_evsel *evsel __use | |||
668 | fprintf(output, " backend cycles idle "); | 672 | fprintf(output, " backend cycles idle "); |
669 | } | 673 | } |
670 | 674 | ||
671 | static void print_branch_misses(int cpu, struct perf_evsel *evsel __used, double avg) | 675 | static void print_branch_misses(int cpu, |
676 | struct perf_evsel *evsel __maybe_unused, | ||
677 | double avg) | ||
672 | { | 678 | { |
673 | double total, ratio = 0.0; | 679 | double total, ratio = 0.0; |
674 | const char *color; | 680 | const char *color; |
@@ -685,7 +691,9 @@ static void print_branch_misses(int cpu, struct perf_evsel *evsel __used, double | |||
685 | fprintf(output, " of all branches "); | 691 | fprintf(output, " of all branches "); |
686 | } | 692 | } |
687 | 693 | ||
688 | static void print_l1_dcache_misses(int cpu, struct perf_evsel *evsel __used, double avg) | 694 | static void print_l1_dcache_misses(int cpu, |
695 | struct perf_evsel *evsel __maybe_unused, | ||
696 | double avg) | ||
689 | { | 697 | { |
690 | double total, ratio = 0.0; | 698 | double total, ratio = 0.0; |
691 | const char *color; | 699 | const char *color; |
@@ -702,7 +710,9 @@ static void print_l1_dcache_misses(int cpu, struct perf_evsel *evsel __used, dou | |||
702 | fprintf(output, " of all L1-dcache hits "); | 710 | fprintf(output, " of all L1-dcache hits "); |
703 | } | 711 | } |
704 | 712 | ||
705 | static void print_l1_icache_misses(int cpu, struct perf_evsel *evsel __used, double avg) | 713 | static void print_l1_icache_misses(int cpu, |
714 | struct perf_evsel *evsel __maybe_unused, | ||
715 | double avg) | ||
706 | { | 716 | { |
707 | double total, ratio = 0.0; | 717 | double total, ratio = 0.0; |
708 | const char *color; | 718 | const char *color; |
@@ -719,7 +729,9 @@ static void print_l1_icache_misses(int cpu, struct perf_evsel *evsel __used, dou | |||
719 | fprintf(output, " of all L1-icache hits "); | 729 | fprintf(output, " of all L1-icache hits "); |
720 | } | 730 | } |
721 | 731 | ||
722 | static void print_dtlb_cache_misses(int cpu, struct perf_evsel *evsel __used, double avg) | 732 | static void print_dtlb_cache_misses(int cpu, |
733 | struct perf_evsel *evsel __maybe_unused, | ||
734 | double avg) | ||
723 | { | 735 | { |
724 | double total, ratio = 0.0; | 736 | double total, ratio = 0.0; |
725 | const char *color; | 737 | const char *color; |
@@ -736,7 +748,9 @@ static void print_dtlb_cache_misses(int cpu, struct perf_evsel *evsel __used, do | |||
736 | fprintf(output, " of all dTLB cache hits "); | 748 | fprintf(output, " of all dTLB cache hits "); |
737 | } | 749 | } |
738 | 750 | ||
739 | static void print_itlb_cache_misses(int cpu, struct perf_evsel *evsel __used, double avg) | 751 | static void print_itlb_cache_misses(int cpu, |
752 | struct perf_evsel *evsel __maybe_unused, | ||
753 | double avg) | ||
740 | { | 754 | { |
741 | double total, ratio = 0.0; | 755 | double total, ratio = 0.0; |
742 | const char *color; | 756 | const char *color; |
@@ -753,7 +767,9 @@ static void print_itlb_cache_misses(int cpu, struct perf_evsel *evsel __used, do | |||
753 | fprintf(output, " of all iTLB cache hits "); | 767 | fprintf(output, " of all iTLB cache hits "); |
754 | } | 768 | } |
755 | 769 | ||
756 | static void print_ll_cache_misses(int cpu, struct perf_evsel *evsel __used, double avg) | 770 | static void print_ll_cache_misses(int cpu, |
771 | struct perf_evsel *evsel __maybe_unused, | ||
772 | double avg) | ||
757 | { | 773 | { |
758 | double total, ratio = 0.0; | 774 | double total, ratio = 0.0; |
759 | const char *color; | 775 | const char *color; |
@@ -1059,8 +1075,8 @@ static const char * const stat_usage[] = { | |||
1059 | NULL | 1075 | NULL |
1060 | }; | 1076 | }; |
1061 | 1077 | ||
1062 | static int stat__set_big_num(const struct option *opt __used, | 1078 | static int stat__set_big_num(const struct option *opt __maybe_unused, |
1063 | const char *s __used, int unset) | 1079 | const char *s __maybe_unused, int unset) |
1064 | { | 1080 | { |
1065 | big_num_opt = unset ? 0 : 1; | 1081 | big_num_opt = unset ? 0 : 1; |
1066 | return 0; | 1082 | return 0; |
@@ -1154,7 +1170,7 @@ static int add_default_attributes(void) | |||
1154 | return perf_evlist__add_default_attrs(evsel_list, very_very_detailed_attrs); | 1170 | return perf_evlist__add_default_attrs(evsel_list, very_very_detailed_attrs); |
1155 | } | 1171 | } |
1156 | 1172 | ||
1157 | int cmd_stat(int argc, const char **argv, const char *prefix __used) | 1173 | int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused) |
1158 | { | 1174 | { |
1159 | struct perf_evsel *pos; | 1175 | struct perf_evsel *pos; |
1160 | int status = -ENOMEM; | 1176 | int status = -ENOMEM; |