aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/lib/traceevent/Makefile2
-rw-r--r--tools/perf/builtin-timechart.c3
-rw-r--r--tools/perf/config/Makefile2
-rw-r--r--tools/perf/perf.h7
-rw-r--r--tools/perf/util/evlist.c7
-rw-r--r--tools/perf/util/evsel.c1
-rw-r--r--tools/perf/util/header.c2
-rw-r--r--tools/perf/util/map.c7
-rw-r--r--tools/perf/util/parse-events.c2
-rw-r--r--tools/perf/util/pmu.c24
-rw-r--r--tools/perf/util/pmu.h2
-rw-r--r--tools/perf/util/session.c10
12 files changed, 51 insertions, 18 deletions
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 56d52a33a3df..005c9cc06935 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -63,7 +63,7 @@ endif
63endif 63endif
64 64
65ifeq ($(set_plugin_dir),1) 65ifeq ($(set_plugin_dir),1)
66PLUGIN_DIR = -DPLUGIN_DIR="$(DESTDIR)/$(plugin_dir)" 66PLUGIN_DIR = -DPLUGIN_DIR="$(plugin_dir)"
67PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))' 67PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))'
68endif 68endif
69 69
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 652af0b66a62..25526d6eae59 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -1045,6 +1045,9 @@ static void write_svg_file(struct timechart *tchart, const char *filename)
1045 thresh /= 10; 1045 thresh /= 10;
1046 } while (!process_filter && thresh && count < tchart->proc_num); 1046 } while (!process_filter && thresh && count < tchart->proc_num);
1047 1047
1048 if (!tchart->proc_num)
1049 count = 0;
1050
1048 open_svg(filename, tchart->numcpus, count, tchart->first_time, tchart->last_time); 1051 open_svg(filename, tchart->numcpus, count, tchart->first_time, tchart->last_time);
1049 1052
1050 svg_time_grid(); 1053 svg_time_grid();
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index d604e50fc167..c48d44958172 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -600,5 +600,5 @@ perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
600# Otherwise we install plugins into the global $(libdir). 600# Otherwise we install plugins into the global $(libdir).
601ifdef DESTDIR 601ifdef DESTDIR
602plugindir=$(libdir)/traceevent/plugins 602plugindir=$(libdir)/traceevent/plugins
603plugindir_SQ= $(subst ','\'',$(prefix)/$(plugindir)) 603plugindir_SQ= $(subst ','\'',$(plugindir))
604endif 604endif
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 3c2f213e979d..7daa806d9050 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -132,6 +132,13 @@
132#define CPUINFO_PROC "CPU" 132#define CPUINFO_PROC "CPU"
133#endif 133#endif
134 134
135#ifdef __xtensa__
136#define mb() asm volatile("memw" ::: "memory")
137#define wmb() asm volatile("memw" ::: "memory")
138#define rmb() asm volatile("" ::: "memory")
139#define CPUINFO_PROC "core ID"
140#endif
141
135#define barrier() asm volatile ("" ::: "memory") 142#define barrier() asm volatile ("" ::: "memory")
136 143
137#ifndef cpu_relax 144#ifndef cpu_relax
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 40bd2c04df8a..59ef2802fcf6 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1003,9 +1003,12 @@ void perf_evlist__close(struct perf_evlist *evlist)
1003 struct perf_evsel *evsel; 1003 struct perf_evsel *evsel;
1004 int ncpus = cpu_map__nr(evlist->cpus); 1004 int ncpus = cpu_map__nr(evlist->cpus);
1005 int nthreads = thread_map__nr(evlist->threads); 1005 int nthreads = thread_map__nr(evlist->threads);
1006 int n;
1006 1007
1007 evlist__for_each_reverse(evlist, evsel) 1008 evlist__for_each_reverse(evlist, evsel) {
1008 perf_evsel__close(evsel, ncpus, nthreads); 1009 n = evsel->cpus ? evsel->cpus->nr : ncpus;
1010 perf_evsel__close(evsel, n, nthreads);
1011 }
1009} 1012}
1010 1013
1011int perf_evlist__open(struct perf_evlist *evlist) 1014int perf_evlist__open(struct perf_evlist *evlist)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 22e18a26b7e6..55407c594b87 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1081,7 +1081,6 @@ void perf_evsel__close(struct perf_evsel *evsel, int ncpus, int nthreads)
1081 1081
1082 perf_evsel__close_fd(evsel, ncpus, nthreads); 1082 perf_evsel__close_fd(evsel, ncpus, nthreads);
1083 perf_evsel__free_fd(evsel); 1083 perf_evsel__free_fd(evsel);
1084 evsel->fd = NULL;
1085} 1084}
1086 1085
1087static struct { 1086static struct {
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index bb3e0ede6183..893f8e2df928 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -930,7 +930,7 @@ static int write_topo_node(int fd, int node)
930 /* skip over invalid lines */ 930 /* skip over invalid lines */
931 if (!strchr(buf, ':')) 931 if (!strchr(buf, ':'))
932 continue; 932 continue;
933 if (sscanf(buf, "%*s %*d %s %"PRIu64, field, &mem) != 2) 933 if (sscanf(buf, "%*s %*d %31s %"PRIu64, field, &mem) != 2)
934 goto done; 934 goto done;
935 if (!strcmp(field, "MemTotal:")) 935 if (!strcmp(field, "MemTotal:"))
936 mem_total = mem; 936 mem_total = mem;
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 9b9bd719aa19..3b97513f0e77 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -69,7 +69,7 @@ struct map *map__new(struct list_head *dsos__list, u64 start, u64 len,
69 map->ino = ino; 69 map->ino = ino;
70 map->ino_generation = ino_gen; 70 map->ino_generation = ino_gen;
71 71
72 if (anon) { 72 if ((anon || no_dso) && type == MAP__FUNCTION) {
73 snprintf(newfilename, sizeof(newfilename), "/tmp/perf-%d.map", pid); 73 snprintf(newfilename, sizeof(newfilename), "/tmp/perf-%d.map", pid);
74 filename = newfilename; 74 filename = newfilename;
75 } 75 }
@@ -93,7 +93,7 @@ struct map *map__new(struct list_head *dsos__list, u64 start, u64 len,
93 * functions still return NULL, and we avoid the 93 * functions still return NULL, and we avoid the
94 * unnecessary map__load warning. 94 * unnecessary map__load warning.
95 */ 95 */
96 if (no_dso) 96 if (type != MAP__FUNCTION)
97 dso__set_loaded(dso, map->type); 97 dso__set_loaded(dso, map->type);
98 } 98 }
99 } 99 }
@@ -386,7 +386,8 @@ struct symbol *map_groups__find_symbol(struct map_groups *mg,
386{ 386{
387 struct map *map = map_groups__find(mg, type, addr); 387 struct map *map = map_groups__find(mg, type, addr);
388 388
389 if (map != NULL) { 389 /* Ensure map is loaded before using map->map_ip */
390 if (map != NULL && map__load(map, filter) >= 0) {
390 if (mapp != NULL) 391 if (mapp != NULL)
391 *mapp = map; 392 *mapp = map;
392 return map__find_symbol(map, map->map_ip(map, addr), filter); 393 return map__find_symbol(map, map->map_ip(map, addr), filter);
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index a7f1b6a91fdd..d248fca6d7ed 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -635,7 +635,7 @@ int parse_events_add_pmu(struct list_head *list, int *idx,
635 struct perf_event_attr attr; 635 struct perf_event_attr attr;
636 struct perf_pmu *pmu; 636 struct perf_pmu *pmu;
637 struct perf_evsel *evsel; 637 struct perf_evsel *evsel;
638 char *unit; 638 const char *unit;
639 double scale; 639 double scale;
640 640
641 pmu = perf_pmu__find(name); 641 pmu = perf_pmu__find(name);
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index d9cab4d27192..b752ecb40d86 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -105,7 +105,7 @@ static int perf_pmu__parse_scale(struct perf_pmu_alias *alias, char *dir, char *
105 char scale[128]; 105 char scale[128];
106 int fd, ret = -1; 106 int fd, ret = -1;
107 char path[PATH_MAX]; 107 char path[PATH_MAX];
108 char *lc; 108 const char *lc;
109 109
110 snprintf(path, PATH_MAX, "%s/%s.scale", dir, name); 110 snprintf(path, PATH_MAX, "%s/%s.scale", dir, name);
111 111
@@ -609,7 +609,7 @@ static struct perf_pmu_alias *pmu_find_alias(struct perf_pmu *pmu,
609 609
610 610
611static int check_unit_scale(struct perf_pmu_alias *alias, 611static int check_unit_scale(struct perf_pmu_alias *alias,
612 char **unit, double *scale) 612 const char **unit, double *scale)
613{ 613{
614 /* 614 /*
615 * Only one term in event definition can 615 * Only one term in event definition can
@@ -634,14 +634,18 @@ static int check_unit_scale(struct perf_pmu_alias *alias,
634 * defined for the alias 634 * defined for the alias
635 */ 635 */
636int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms, 636int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms,
637 char **unit, double *scale) 637 const char **unit, double *scale)
638{ 638{
639 struct parse_events_term *term, *h; 639 struct parse_events_term *term, *h;
640 struct perf_pmu_alias *alias; 640 struct perf_pmu_alias *alias;
641 int ret; 641 int ret;
642 642
643 /*
644 * Mark unit and scale as not set
645 * (different from default values, see below)
646 */
643 *unit = NULL; 647 *unit = NULL;
644 *scale = 0; 648 *scale = 0.0;
645 649
646 list_for_each_entry_safe(term, h, head_terms, list) { 650 list_for_each_entry_safe(term, h, head_terms, list) {
647 alias = pmu_find_alias(pmu, term); 651 alias = pmu_find_alias(pmu, term);
@@ -658,6 +662,18 @@ int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms,
658 list_del(&term->list); 662 list_del(&term->list);
659 free(term); 663 free(term);
660 } 664 }
665
666 /*
667 * if no unit or scale foundin aliases, then
668 * set defaults as for evsel
669 * unit cannot left to NULL
670 */
671 if (*unit == NULL)
672 *unit = "";
673
674 if (*scale == 0.0)
675 *scale = 1.0;
676
661 return 0; 677 return 0;
662} 678}
663 679
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 9183380e2038..8b64125a9281 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -29,7 +29,7 @@ int perf_pmu__config_terms(struct list_head *formats,
29 struct perf_event_attr *attr, 29 struct perf_event_attr *attr,
30 struct list_head *head_terms); 30 struct list_head *head_terms);
31int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms, 31int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms,
32 char **unit, double *scale); 32 const char **unit, double *scale);
33struct list_head *perf_pmu__alias(struct perf_pmu *pmu, 33struct list_head *perf_pmu__alias(struct perf_pmu *pmu,
34 struct list_head *head_terms); 34 struct list_head *head_terms);
35int perf_pmu_wrap(void); 35int perf_pmu_wrap(void);
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 7acc03e8f3b2..0b39a48e5110 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1573,7 +1573,7 @@ next:
1573int perf_session__cpu_bitmap(struct perf_session *session, 1573int perf_session__cpu_bitmap(struct perf_session *session,
1574 const char *cpu_list, unsigned long *cpu_bitmap) 1574 const char *cpu_list, unsigned long *cpu_bitmap)
1575{ 1575{
1576 int i; 1576 int i, err = -1;
1577 struct cpu_map *map; 1577 struct cpu_map *map;
1578 1578
1579 for (i = 0; i < PERF_TYPE_MAX; ++i) { 1579 for (i = 0; i < PERF_TYPE_MAX; ++i) {
@@ -1602,13 +1602,17 @@ int perf_session__cpu_bitmap(struct perf_session *session,
1602 if (cpu >= MAX_NR_CPUS) { 1602 if (cpu >= MAX_NR_CPUS) {
1603 pr_err("Requested CPU %d too large. " 1603 pr_err("Requested CPU %d too large. "
1604 "Consider raising MAX_NR_CPUS\n", cpu); 1604 "Consider raising MAX_NR_CPUS\n", cpu);
1605 return -1; 1605 goto out_delete_map;
1606 } 1606 }
1607 1607
1608 set_bit(cpu, cpu_bitmap); 1608 set_bit(cpu, cpu_bitmap);
1609 } 1609 }
1610 1610
1611 return 0; 1611 err = 0;
1612
1613out_delete_map:
1614 cpu_map__delete(map);
1615 return err;
1612} 1616}
1613 1617
1614void perf_session__fprintf_info(struct perf_session *session, FILE *fp, 1618void perf_session__fprintf_info(struct perf_session *session, FILE *fp,