cpu: implement a bi-mode branch predictor
[gem5.git] / src / cpu / kvm / perfevent.hh
index 8242cc071d42aa0ca18f9b61c1f9b52000eec41d..b1b0da283d95336bbf164292c10a9bbe7b22dcfc 100644 (file)
@@ -45,6 +45,8 @@
 
 #include <inttypes.h>
 
+#include "config/have_perf_attr_exclude_host.hh"
+
 /**
  * PerfEvent counter configuration.
  */
@@ -125,6 +127,39 @@ class PerfKvmCounterConfig
         return *this;
     }
 
+    /**
+     * Exclude the events from the host (i.e., only include events
+     * from the guest system).
+     *
+     * Intel CPUs seem to support this attribute from Linux 3.2 and
+     * onwards. Non-x86 architectures currently ignore this attribute
+     * (Linux 3.12-rc5).
+     *
+     * @warn This attribute is ignored if it isn't present in the
+     * kernel headers or if the kernel doesn't support it.
+     *
+     * @param val true to exclude host events
+     */
+    PerfKvmCounterConfig &exclude_host(bool val) {
+#if HAVE_PERF_ATTR_EXCLUDE_HOST == 1
+        attr.exclude_host = val;
+#endif
+        return *this;
+    }
+
+    /**
+     * Exclude the hyper visor (i.e., only include events from the
+     * guest system).
+     *
+     * @warn This is attribute only seems to be ignored on Intel.
+     *
+     * @param val true to exclude host events
+     */
+    PerfKvmCounterConfig &exclude_hv(bool val) {
+        attr.exclude_hv = val;
+        return *this;
+    }
+
     /** Underlying perf_event_attr structure describing the counter */
     struct perf_event_attr attr;
 };
@@ -217,7 +252,8 @@ public:
      * like the new period isn't effective until after the next
      * counter overflow. If you use this method to change the sample
      * period, you will see one sample with the old period and then
-     * start sampling with the new period.
+     * start sampling with the new period. This problem was fixed for
+     * ARM in version 3.7 of the kernel.
      *
      * @warning This method doesn't work at all on some 2.6.3x kernels
      * since it has inverted check for the return value when copying