|
@@ -17,6 +17,7 @@
|
|
|
#include <linux/debugfs.h>
|
|
|
#include <linux/kthread.h>
|
|
|
#include <linux/mman.h>
|
|
|
+#include <linux/perf_event.h>
|
|
|
#include <linux/pm_qos.h>
|
|
|
#include <linux/slab.h>
|
|
|
#include <linux/uaccess.h>
|
|
@@ -915,6 +916,31 @@ static int measure_cycles_lat_fn(void *_plr)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * Create a perf_event_attr for the hit and miss perf events that will
|
|
|
+ * be used during the performance measurement. A perf_event maintains
|
|
|
+ * a pointer to its perf_event_attr so a unique attribute structure is
|
|
|
+ * created for each perf_event.
|
|
|
+ *
|
|
|
+ * The actual configuration of the event is set right before use in order
|
|
|
+ * to use the X86_CONFIG macro.
|
|
|
+ */
|
|
|
+static struct perf_event_attr __attribute__((unused)) perf_miss_attr = {
|
|
|
+ .type = PERF_TYPE_RAW,
|
|
|
+ .size = sizeof(struct perf_event_attr),
|
|
|
+ .pinned = 1,
|
|
|
+ .disabled = 0,
|
|
|
+ .exclude_user = 1,
|
|
|
+};
|
|
|
+
|
|
|
+static struct perf_event_attr __attribute__((unused)) perf_hit_attr = {
|
|
|
+ .type = PERF_TYPE_RAW,
|
|
|
+ .size = sizeof(struct perf_event_attr),
|
|
|
+ .pinned = 1,
|
|
|
+ .disabled = 0,
|
|
|
+ .exclude_user = 1,
|
|
|
+};
|
|
|
+
|
|
|
static int measure_cycles_perf_fn(void *_plr)
|
|
|
{
|
|
|
unsigned long long l3_hits = 0, l3_miss = 0;
|