aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-kvm.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-kvm.c')
-rw-r--r--tools/perf/builtin-kvm.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 0c36f2ac6a0e..55d919dc5bc6 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -26,6 +26,9 @@
26#include <sys/timerfd.h> 26#include <sys/timerfd.h>
27#endif 27#endif
28#include <sys/time.h> 28#include <sys/time.h>
29#include <sys/types.h>
30#include <sys/stat.h>
31#include <fcntl.h>
29 32
30#include <linux/kernel.h> 33#include <linux/kernel.h>
31#include <linux/time64.h> 34#include <linux/time64.h>
@@ -741,20 +744,20 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx,
741 u64 *mmap_time) 744 u64 *mmap_time)
742{ 745{
743 union perf_event *event; 746 union perf_event *event;
744 struct perf_sample sample; 747 u64 timestamp;
745 s64 n = 0; 748 s64 n = 0;
746 int err; 749 int err;
747 750
748 *mmap_time = ULLONG_MAX; 751 *mmap_time = ULLONG_MAX;
749 while ((event = perf_evlist__mmap_read(kvm->evlist, idx)) != NULL) { 752 while ((event = perf_evlist__mmap_read(kvm->evlist, idx)) != NULL) {
750 err = perf_evlist__parse_sample(kvm->evlist, event, &sample); 753 err = perf_evlist__parse_sample_timestamp(kvm->evlist, event, &timestamp);
751 if (err) { 754 if (err) {
752 perf_evlist__mmap_consume(kvm->evlist, idx); 755 perf_evlist__mmap_consume(kvm->evlist, idx);
753 pr_err("Failed to parse sample\n"); 756 pr_err("Failed to parse sample\n");
754 return -1; 757 return -1;
755 } 758 }
756 759
757 err = perf_session__queue_event(kvm->session, event, &sample, 0); 760 err = perf_session__queue_event(kvm->session, event, timestamp, 0);
758 /* 761 /*
759 * FIXME: Here we can't consume the event, as perf_session__queue_event will 762 * FIXME: Here we can't consume the event, as perf_session__queue_event will
760 * point to it, and it'll get possibly overwritten by the kernel. 763 * point to it, and it'll get possibly overwritten by the kernel.
@@ -768,7 +771,7 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx,
768 771
769 /* save time stamp of our first sample for this mmap */ 772 /* save time stamp of our first sample for this mmap */
770 if (n == 0) 773 if (n == 0)
771 *mmap_time = sample.time; 774 *mmap_time = timestamp;
772 775
773 /* limit events per mmap handled all at once */ 776 /* limit events per mmap handled all at once */
774 n++; 777 n++;
@@ -1044,7 +1047,7 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm)
1044 goto out; 1047 goto out;
1045 } 1048 }
1046 1049
1047 if (perf_evlist__mmap(evlist, kvm->opts.mmap_pages, false) < 0) { 1050 if (perf_evlist__mmap(evlist, kvm->opts.mmap_pages) < 0) {
1048 ui__error("Failed to mmap the events: %s\n", 1051 ui__error("Failed to mmap the events: %s\n",
1049 str_error_r(errno, sbuf, sizeof(sbuf))); 1052 str_error_r(errno, sbuf, sizeof(sbuf)));
1050 perf_evlist__close(evlist); 1053 perf_evlist__close(evlist);