aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-annotate.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r--tools/perf/builtin-annotate.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 3bedaa5d21d2..32ff9838351e 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -81,7 +81,7 @@ struct hist_entry {
81struct sort_entry { 81struct sort_entry {
82 struct list_head list; 82 struct list_head list;
83 83
84 char *header; 84 const char *header;
85 85
86 int64_t (*cmp)(struct hist_entry *, struct hist_entry *); 86 int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
87 int64_t (*collapse)(struct hist_entry *, struct hist_entry *); 87 int64_t (*collapse)(struct hist_entry *, struct hist_entry *);
@@ -225,7 +225,7 @@ static struct sort_entry sort_sym = {
225static int sort__need_collapse = 0; 225static int sort__need_collapse = 0;
226 226
227struct sort_dimension { 227struct sort_dimension {
228 char *name; 228 const char *name;
229 struct sort_entry *entry; 229 struct sort_entry *entry;
230 int taken; 230 int taken;
231}; 231};
@@ -723,7 +723,7 @@ parse_line(FILE *file, struct symbol *sym, u64 start, u64 len)
723 const char *path = NULL; 723 const char *path = NULL;
724 unsigned int hits = 0; 724 unsigned int hits = 0;
725 double percent = 0.0; 725 double percent = 0.0;
726 char *color; 726 const char *color;
727 struct sym_ext *sym_ext = sym->priv; 727 struct sym_ext *sym_ext = sym->priv;
728 728
729 offset = line_ip - start; 729 offset = line_ip - start;
@@ -805,7 +805,7 @@ static void free_source_line(struct symbol *sym, int len)
805 805
806/* Get the filename:line for the colored entries */ 806/* Get the filename:line for the colored entries */
807static void 807static void
808get_source_line(struct symbol *sym, u64 start, int len, char *filename) 808get_source_line(struct symbol *sym, u64 start, int len, const char *filename)
809{ 809{
810 int i; 810 int i;
811 char cmd[PATH_MAX * 2]; 811 char cmd[PATH_MAX * 2];
@@ -851,7 +851,7 @@ get_source_line(struct symbol *sym, u64 start, int len, char *filename)
851 } 851 }
852} 852}
853 853
854static void print_summary(char *filename) 854static void print_summary(const char *filename)
855{ 855{
856 struct sym_ext *sym_ext; 856 struct sym_ext *sym_ext;
857 struct rb_node *node; 857 struct rb_node *node;
@@ -867,7 +867,7 @@ static void print_summary(char *filename)
867 node = rb_first(&root_sym_ext); 867 node = rb_first(&root_sym_ext);
868 while (node) { 868 while (node) {
869 double percent; 869 double percent;
870 char *color; 870 const char *color;
871 char *path; 871 char *path;
872 872
873 sym_ext = rb_entry(node, struct sym_ext, node); 873 sym_ext = rb_entry(node, struct sym_ext, node);
@@ -882,7 +882,7 @@ static void print_summary(char *filename)
882 882
883static void annotate_sym(struct dso *dso, struct symbol *sym) 883static void annotate_sym(struct dso *dso, struct symbol *sym)
884{ 884{
885 char *filename = dso->name, *d_filename; 885 const char *filename = dso->name, *d_filename;
886 u64 start, end, len; 886 u64 start, end, len;
887 char command[PATH_MAX*2]; 887 char command[PATH_MAX*2];
888 FILE *file; 888 FILE *file;
@@ -892,7 +892,7 @@ static void annotate_sym(struct dso *dso, struct symbol *sym)
892 if (sym->module) 892 if (sym->module)
893 filename = sym->module->path; 893 filename = sym->module->path;
894 else if (dso == kernel_dso) 894 else if (dso == kernel_dso)
895 filename = vmlinux; 895 filename = vmlinux_name;
896 896
897 start = sym->obj_start; 897 start = sym->obj_start;
898 if (!start) 898 if (!start)
@@ -964,7 +964,7 @@ static int __cmd_annotate(void)
964 int ret, rc = EXIT_FAILURE; 964 int ret, rc = EXIT_FAILURE;
965 unsigned long offset = 0; 965 unsigned long offset = 0;
966 unsigned long head = 0; 966 unsigned long head = 0;
967 struct stat stat; 967 struct stat input_stat;
968 event_t *event; 968 event_t *event;
969 uint32_t size; 969 uint32_t size;
970 char *buf; 970 char *buf;
@@ -977,13 +977,13 @@ static int __cmd_annotate(void)
977 exit(-1); 977 exit(-1);
978 } 978 }
979 979
980 ret = fstat(input, &stat); 980 ret = fstat(input, &input_stat);
981 if (ret < 0) { 981 if (ret < 0) {
982 perror("failed to stat file"); 982 perror("failed to stat file");
983 exit(-1); 983 exit(-1);
984 } 984 }
985 985
986 if (!stat.st_size) { 986 if (!input_stat.st_size) {
987 fprintf(stderr, "zero-sized file, nothing to do!\n"); 987 fprintf(stderr, "zero-sized file, nothing to do!\n");
988 exit(0); 988 exit(0);
989 } 989 }
@@ -1010,10 +1010,10 @@ more:
1010 1010
1011 if (head + event->header.size >= page_size * mmap_window) { 1011 if (head + event->header.size >= page_size * mmap_window) {
1012 unsigned long shift = page_size * (head / page_size); 1012 unsigned long shift = page_size * (head / page_size);
1013 int ret; 1013 int munmap_ret;
1014 1014
1015 ret = munmap(buf, page_size * mmap_window); 1015 munmap_ret = munmap(buf, page_size * mmap_window);
1016 assert(ret == 0); 1016 assert(munmap_ret == 0);
1017 1017
1018 offset += shift; 1018 offset += shift;
1019 head -= shift; 1019 head -= shift;
@@ -1049,7 +1049,7 @@ more:
1049 1049
1050 head += size; 1050 head += size;
1051 1051
1052 if (offset + head < (unsigned long)stat.st_size) 1052 if (offset + head < (unsigned long)input_stat.st_size)
1053 goto more; 1053 goto more;
1054 1054
1055 rc = EXIT_SUCCESS; 1055 rc = EXIT_SUCCESS;
@@ -1092,7 +1092,7 @@ static const struct option options[] = {
1092 "be more verbose (show symbol address, etc)"), 1092 "be more verbose (show symbol address, etc)"),
1093 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, 1093 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
1094 "dump raw trace in ASCII"), 1094 "dump raw trace in ASCII"),
1095 OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"), 1095 OPT_STRING('k', "vmlinux", &vmlinux_name, "file", "vmlinux pathname"),
1096 OPT_BOOLEAN('m', "modules", &modules, 1096 OPT_BOOLEAN('m', "modules", &modules,
1097 "load module symbols - WARNING: use only with -k and LIVE kernel"), 1097 "load module symbols - WARNING: use only with -k and LIVE kernel"),
1098 OPT_BOOLEAN('l', "print-line", &print_line, 1098 OPT_BOOLEAN('l', "print-line", &print_line,