|
@@ -20,7 +20,9 @@
|
|
|
#include "util/data.h"
|
|
|
|
|
|
#include <sys/prctl.h>
|
|
|
+#ifdef HAVE_TIMERFD_SUPPORT
|
|
|
#include <sys/timerfd.h>
|
|
|
+#endif
|
|
|
|
|
|
#include <termios.h>
|
|
|
#include <semaphore.h>
|
|
@@ -337,6 +339,7 @@ static void init_kvm_event_record(struct perf_kvm_stat *kvm)
|
|
|
INIT_LIST_HEAD(&kvm->kvm_events_cache[i]);
|
|
|
}
|
|
|
|
|
|
+#ifdef HAVE_TIMERFD_SUPPORT
|
|
|
static void clear_events_cache_stats(struct list_head *kvm_events_cache)
|
|
|
{
|
|
|
struct list_head *head;
|
|
@@ -358,6 +361,7 @@ static void clear_events_cache_stats(struct list_head *kvm_events_cache)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+#endif
|
|
|
|
|
|
static int kvm_events_hash_fn(u64 key)
|
|
|
{
|
|
@@ -783,6 +787,7 @@ static void print_result(struct perf_kvm_stat *kvm)
|
|
|
pr_info("\nLost events: %" PRIu64 "\n\n", kvm->lost_events);
|
|
|
}
|
|
|
|
|
|
+#ifdef HAVE_TIMERFD_SUPPORT
|
|
|
static int process_lost_event(struct perf_tool *tool,
|
|
|
union perf_event *event __maybe_unused,
|
|
|
struct perf_sample *sample __maybe_unused,
|
|
@@ -793,6 +798,7 @@ static int process_lost_event(struct perf_tool *tool,
|
|
|
kvm->lost_events++;
|
|
|
return 0;
|
|
|
}
|
|
|
+#endif
|
|
|
|
|
|
static bool skip_sample(struct perf_kvm_stat *kvm,
|
|
|
struct perf_sample *sample)
|
|
@@ -872,6 +878,7 @@ static bool verify_vcpu(int vcpu)
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+#ifdef HAVE_TIMERFD_SUPPORT
|
|
|
/* keeping the max events to a modest level to keep
|
|
|
* the processing of samples per mmap smooth.
|
|
|
*/
|
|
@@ -1213,6 +1220,7 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm)
|
|
|
out:
|
|
|
return rc;
|
|
|
}
|
|
|
+#endif
|
|
|
|
|
|
static int read_events(struct perf_kvm_stat *kvm)
|
|
|
{
|
|
@@ -1379,6 +1387,7 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv)
|
|
|
return kvm_events_report_vcpu(kvm);
|
|
|
}
|
|
|
|
|
|
+#ifdef HAVE_TIMERFD_SUPPORT
|
|
|
static struct perf_evlist *kvm_live_event_list(void)
|
|
|
{
|
|
|
struct perf_evlist *evlist;
|
|
@@ -1566,6 +1575,7 @@ out:
|
|
|
|
|
|
return err;
|
|
|
}
|
|
|
+#endif
|
|
|
|
|
|
static void print_kvm_stat_usage(void)
|
|
|
{
|
|
@@ -1604,8 +1614,10 @@ static int kvm_cmd_stat(const char *file_name, int argc, const char **argv)
|
|
|
if (!strncmp(argv[1], "rep", 3))
|
|
|
return kvm_events_report(&kvm, argc - 1 , argv + 1);
|
|
|
|
|
|
+#ifdef HAVE_TIMERFD_SUPPORT
|
|
|
if (!strncmp(argv[1], "live", 4))
|
|
|
return kvm_events_live(&kvm, argc - 1 , argv + 1);
|
|
|
+#endif
|
|
|
|
|
|
perf_stat:
|
|
|
return cmd_stat(argc, argv, NULL);
|