aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/evsel.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/evsel.c')
-rw-r--r--tools/perf/util/evsel.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 3a334f001997..5280820ed389 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -663,7 +663,7 @@ void perf_evsel__config(struct perf_evsel *evsel,
663 } 663 }
664 664
665 if (opts->sample_address) 665 if (opts->sample_address)
666 attr->sample_type |= PERF_SAMPLE_DATA_SRC; 666 perf_evsel__set_sample_bit(evsel, DATA_SRC);
667 667
668 if (opts->no_delay) { 668 if (opts->no_delay) {
669 attr->watermark = 0; 669 attr->watermark = 0;
@@ -675,13 +675,13 @@ void perf_evsel__config(struct perf_evsel *evsel,
675 } 675 }
676 676
677 if (opts->sample_weight) 677 if (opts->sample_weight)
678 attr->sample_type |= PERF_SAMPLE_WEIGHT; 678 perf_evsel__set_sample_bit(evsel, WEIGHT);
679 679
680 attr->mmap = track; 680 attr->mmap = track;
681 attr->comm = track; 681 attr->comm = track;
682 682
683 if (opts->sample_transaction) 683 if (opts->sample_transaction)
684 attr->sample_type |= PERF_SAMPLE_TRANSACTION; 684 perf_evsel__set_sample_bit(evsel, TRANSACTION);
685 685
686 /* 686 /*
687 * XXX see the function comment above 687 * XXX see the function comment above
@@ -1051,6 +1051,8 @@ retry_open:
1051 group_fd, flags); 1051 group_fd, flags);
1052 if (FD(evsel, cpu, thread) < 0) { 1052 if (FD(evsel, cpu, thread) < 0) {
1053 err = -errno; 1053 err = -errno;
1054 pr_debug2("perf_event_open failed, error %d\n",
1055 err);
1054 goto try_fallback; 1056 goto try_fallback;
1055 } 1057 }
1056 set_rlimit = NO_CHANGE; 1058 set_rlimit = NO_CHANGE;
@@ -1479,6 +1481,7 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
1479 1481
1480 data->transaction = 0; 1482 data->transaction = 0;
1481 if (type & PERF_SAMPLE_TRANSACTION) { 1483 if (type & PERF_SAMPLE_TRANSACTION) {
1484 OVERFLOW_CHECK_u64(array);
1482 data->transaction = *array; 1485 data->transaction = *array;
1483 array++; 1486 array++;
1484 } 1487 }
@@ -1575,6 +1578,9 @@ size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
1575 if (type & PERF_SAMPLE_DATA_SRC) 1578 if (type & PERF_SAMPLE_DATA_SRC)
1576 result += sizeof(u64); 1579 result += sizeof(u64);
1577 1580
1581 if (type & PERF_SAMPLE_TRANSACTION)
1582 result += sizeof(u64);
1583
1578 return result; 1584 return result;
1579} 1585}
1580 1586
@@ -1748,6 +1754,11 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
1748 array++; 1754 array++;
1749 } 1755 }
1750 1756
1757 if (type & PERF_SAMPLE_TRANSACTION) {
1758 *array = sample->transaction;
1759 array++;
1760 }
1761
1751 return 0; 1762 return 0;
1752} 1763}
1753 1764