aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2019-09-02 16:15:47 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-09-25 08:51:47 -0400
commite7eb9002d4513ac4a26c756b72e6c25bf063baf2 (patch)
treec35f7f4f915429ca7e3feb2a97c6ea93ad2cb4d4 /tools
parentdeaf321913a7b1d440c5cd5c7766d47381c9b21b (diff)
libperf: Move 'ids' from 'struct evsel' to 'struct perf_evsel'
Move 'ids' from 'struct evsel' to libperf's 'struct perf_evsel'. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lore.kernel.org/lkml/20190913132355.21634-26-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/lib/include/internal/evsel.h1
-rw-r--r--tools/perf/util/evlist.c2
-rw-r--r--tools/perf/util/evsel.c2
-rw-r--r--tools/perf/util/evsel.h1
-rw-r--r--tools/perf/util/header.c14
-rw-r--r--tools/perf/util/intel-bts.c2
-rw-r--r--tools/perf/util/intel-pt.c2
-rw-r--r--tools/perf/util/synthetic-events.c6
8 files changed, 15 insertions, 15 deletions
diff --git a/tools/perf/lib/include/internal/evsel.h b/tools/perf/lib/include/internal/evsel.h
index e7171948c347..385766f06591 100644
--- a/tools/perf/lib/include/internal/evsel.h
+++ b/tools/perf/lib/include/internal/evsel.h
@@ -19,6 +19,7 @@ struct perf_evsel {
19 struct xyarray *fd; 19 struct xyarray *fd;
20 struct xyarray *sample_id; 20 struct xyarray *sample_id;
21 u64 *id; 21 u64 *id;
22 u32 ids;
22 23
23 /* parse modifier helper */ 24 /* parse modifier helper */
24 int nr_members; 25 int nr_members;
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 24f03f245525..5e43fb9da359 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -482,7 +482,7 @@ void perf_evlist__id_add(struct evlist *evlist, struct evsel *evsel,
482 int cpu, int thread, u64 id) 482 int cpu, int thread, u64 id)
483{ 483{
484 perf_evlist__id_hash(evlist, evsel, cpu, thread, id); 484 perf_evlist__id_hash(evlist, evsel, cpu, thread, id);
485 evsel->core.id[evsel->ids++] = id; 485 evsel->core.id[evsel->core.ids++] = id;
486} 486}
487 487
488int perf_evlist__id_add_fd(struct evlist *evlist, 488int perf_evlist__id_add_fd(struct evlist *evlist,
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 9c1b4f4a5fa3..55638eb9299c 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1254,7 +1254,7 @@ static void perf_evsel__free_id(struct evsel *evsel)
1254 xyarray__delete(evsel->core.sample_id); 1254 xyarray__delete(evsel->core.sample_id);
1255 evsel->core.sample_id = NULL; 1255 evsel->core.sample_id = NULL;
1256 zfree(&evsel->core.id); 1256 zfree(&evsel->core.id);
1257 evsel->ids = 0; 1257 evsel->core.ids = 0;
1258} 1258}
1259 1259
1260static void perf_evsel__free_config_terms(struct evsel *evsel) 1260static void perf_evsel__free_config_terms(struct evsel *evsel)
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 0d2aa933ceb3..ed64395ec340 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -119,7 +119,6 @@ struct evsel {
119 struct perf_counts *counts; 119 struct perf_counts *counts;
120 struct perf_counts *prev_raw_counts; 120 struct perf_counts *prev_raw_counts;
121 int idx; 121 int idx;
122 u32 ids;
123 unsigned long max_events; 122 unsigned long max_events;
124 unsigned long nr_events_printed; 123 unsigned long nr_events_printed;
125 char *name; 124 char *name;
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 2b0681ab08aa..498f6a825656 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -516,7 +516,7 @@ static int write_event_desc(struct feat_fd *ff,
516 * copy into an nri to be independent of the 516 * copy into an nri to be independent of the
517 * type of ids, 517 * type of ids,
518 */ 518 */
519 nri = evsel->ids; 519 nri = evsel->core.ids;
520 ret = do_write(ff, &nri, sizeof(nri)); 520 ret = do_write(ff, &nri, sizeof(nri));
521 if (ret < 0) 521 if (ret < 0)
522 return ret; 522 return ret;
@@ -530,7 +530,7 @@ static int write_event_desc(struct feat_fd *ff,
530 /* 530 /*
531 * write unique ids for this event 531 * write unique ids for this event
532 */ 532 */
533 ret = do_write(ff, evsel->core.id, evsel->ids * sizeof(u64)); 533 ret = do_write(ff, evsel->core.id, evsel->core.ids * sizeof(u64));
534 if (ret < 0) 534 if (ret < 0)
535 return ret; 535 return ret;
536 } 536 }
@@ -1656,7 +1656,7 @@ static struct evsel *read_event_desc(struct feat_fd *ff)
1656 id = calloc(nr, sizeof(*id)); 1656 id = calloc(nr, sizeof(*id));
1657 if (!id) 1657 if (!id)
1658 goto error; 1658 goto error;
1659 evsel->ids = nr; 1659 evsel->core.ids = nr;
1660 evsel->core.id = id; 1660 evsel->core.id = id;
1661 1661
1662 for (j = 0 ; j < nr; j++) { 1662 for (j = 0 ; j < nr; j++) {
@@ -1699,9 +1699,9 @@ static void print_event_desc(struct feat_fd *ff, FILE *fp)
1699 for (evsel = events; evsel->core.attr.size; evsel++) { 1699 for (evsel = events; evsel->core.attr.size; evsel++) {
1700 fprintf(fp, "# event : name = %s, ", evsel->name); 1700 fprintf(fp, "# event : name = %s, ", evsel->name);
1701 1701
1702 if (evsel->ids) { 1702 if (evsel->core.ids) {
1703 fprintf(fp, ", id = {"); 1703 fprintf(fp, ", id = {");
1704 for (j = 0, id = evsel->core.id; j < evsel->ids; j++, id++) { 1704 for (j = 0, id = evsel->core.id; j < evsel->core.ids; j++, id++) {
1705 if (j) 1705 if (j)
1706 fputc(',', fp); 1706 fputc(',', fp);
1707 fprintf(fp, " %"PRIu64, *id); 1707 fprintf(fp, " %"PRIu64, *id);
@@ -3068,7 +3068,7 @@ int perf_session__write_header(struct perf_session *session,
3068 3068
3069 evlist__for_each_entry(session->evlist, evsel) { 3069 evlist__for_each_entry(session->evlist, evsel) {
3070 evsel->id_offset = lseek(fd, 0, SEEK_CUR); 3070 evsel->id_offset = lseek(fd, 0, SEEK_CUR);
3071 err = do_write(&ff, evsel->core.id, evsel->ids * sizeof(u64)); 3071 err = do_write(&ff, evsel->core.id, evsel->core.ids * sizeof(u64));
3072 if (err < 0) { 3072 if (err < 0) {
3073 pr_debug("failed to write perf header\n"); 3073 pr_debug("failed to write perf header\n");
3074 return err; 3074 return err;
@@ -3082,7 +3082,7 @@ int perf_session__write_header(struct perf_session *session,
3082 .attr = evsel->core.attr, 3082 .attr = evsel->core.attr,
3083 .ids = { 3083 .ids = {
3084 .offset = evsel->id_offset, 3084 .offset = evsel->id_offset,
3085 .size = evsel->ids * sizeof(u64), 3085 .size = evsel->core.ids * sizeof(u64),
3086 } 3086 }
3087 }; 3087 };
3088 err = do_write(&ff, &f_attr, sizeof(f_attr)); 3088 err = do_write(&ff, &f_attr, sizeof(f_attr));
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index c94360cd9c00..34cb380d19a3 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -768,7 +768,7 @@ static int intel_bts_synth_events(struct intel_bts *bts,
768 int err; 768 int err;
769 769
770 evlist__for_each_entry(evlist, evsel) { 770 evlist__for_each_entry(evlist, evsel) {
771 if (evsel->core.attr.type == bts->pmu_type && evsel->ids) { 771 if (evsel->core.attr.type == bts->pmu_type && evsel->core.ids) {
772 found = true; 772 found = true;
773 break; 773 break;
774 } 774 }
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 24ca5d5908ca..a1c9eb6d4f40 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -2735,7 +2735,7 @@ static struct evsel *intel_pt_evsel(struct intel_pt *pt,
2735 struct evsel *evsel; 2735 struct evsel *evsel;
2736 2736
2737 evlist__for_each_entry(evlist, evsel) { 2737 evlist__for_each_entry(evlist, evsel) {
2738 if (evsel->core.attr.type == pt->pmu_type && evsel->ids) 2738 if (evsel->core.attr.type == pt->pmu_type && evsel->core.ids)
2739 return evsel; 2739 return evsel;
2740 } 2740 }
2741 2741
diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c
index 907ac3971959..96ed008c2775 100644
--- a/tools/perf/util/synthetic-events.c
+++ b/tools/perf/util/synthetic-events.c
@@ -1413,7 +1413,7 @@ int perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__handler_
1413 sizeof(struct id_index_entry); 1413 sizeof(struct id_index_entry);
1414 1414
1415 evlist__for_each_entry(evlist, evsel) 1415 evlist__for_each_entry(evlist, evsel)
1416 nr += evsel->ids; 1416 nr += evsel->core.ids;
1417 1417
1418 n = nr > max_nr ? max_nr : nr; 1418 n = nr > max_nr ? max_nr : nr;
1419 sz = sizeof(struct perf_record_id_index) + n * sizeof(struct id_index_entry); 1419 sz = sizeof(struct perf_record_id_index) + n * sizeof(struct id_index_entry);
@@ -1428,7 +1428,7 @@ int perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__handler_
1428 evlist__for_each_entry(evlist, evsel) { 1428 evlist__for_each_entry(evlist, evsel) {
1429 u32 j; 1429 u32 j;
1430 1430
1431 for (j = 0; j < evsel->ids; j++) { 1431 for (j = 0; j < evsel->core.ids; j++) {
1432 struct id_index_entry *e; 1432 struct id_index_entry *e;
1433 struct perf_sample_id *sid; 1433 struct perf_sample_id *sid;
1434 1434
@@ -1595,7 +1595,7 @@ int perf_event__synthesize_attrs(struct perf_tool *tool, struct evlist *evlist,
1595 int err = 0; 1595 int err = 0;
1596 1596
1597 evlist__for_each_entry(evlist, evsel) { 1597 evlist__for_each_entry(evlist, evsel) {
1598 err = perf_event__synthesize_attr(tool, &evsel->core.attr, evsel->ids, 1598 err = perf_event__synthesize_attr(tool, &evsel->core.attr, evsel->core.ids,
1599 evsel->core.id, process); 1599 evsel->core.id, process);
1600 if (err) { 1600 if (err) {
1601 pr_debug("failed to create perf header attribute\n"); 1601 pr_debug("failed to create perf header attribute\n");