perfevent.hh (9655:78c9adc85718) perfevent.hh (9986:7cab06691984)
1/*
2 * Copyright (c) 2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 31 unchanged lines hidden (view full) ---

40#ifndef __CPU_KVM_PERFEVENT_HH__
41#define __CPU_KVM_PERFEVENT_HH__
42
43#include <linux/perf_event.h>
44#include <sys/types.h>
45
46#include <inttypes.h>
47
1/*
2 * Copyright (c) 2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 31 unchanged lines hidden (view full) ---

40#ifndef __CPU_KVM_PERFEVENT_HH__
41#define __CPU_KVM_PERFEVENT_HH__
42
43#include <linux/perf_event.h>
44#include <sys/types.h>
45
46#include <inttypes.h>
47
48#include "config/have_perf_attr_exclude_host.hh"
49
48/**
49 * PerfEvent counter configuration.
50 */
51class PerfKvmCounterConfig
52{
53 public:
54 /**
55 * Initialize PerfEvent counter configuration structure

--- 64 unchanged lines hidden (view full) ---

120 *
121 * @param val true to pin the counter
122 */
123 PerfKvmCounterConfig &pinned(bool val) {
124 attr.pinned = val;
125 return *this;
126 }
127
50/**
51 * PerfEvent counter configuration.
52 */
53class PerfKvmCounterConfig
54{
55 public:
56 /**
57 * Initialize PerfEvent counter configuration structure

--- 64 unchanged lines hidden (view full) ---

122 *
123 * @param val true to pin the counter
124 */
125 PerfKvmCounterConfig &pinned(bool val) {
126 attr.pinned = val;
127 return *this;
128 }
129
130 /**
131 * Exclude the events from the host (i.e., only include events
132 * from the guest system).
133 *
134 * Intel CPUs seem to support this attribute from Linux 3.2 and
135 * onwards. Non-x86 architectures currently ignore this attribute
136 * (Linux 3.12-rc5).
137 *
138 * @warn This attribute is ignored if it isn't present in the
139 * kernel headers or if the kernel doesn't support it.
140 *
141 * @param val true to exclude host events
142 */
143 PerfKvmCounterConfig &exclude_host(bool val) {
144#if HAVE_PERF_ATTR_EXCLUDE_HOST == 1
145 attr.exclude_host = val;
146#endif
147 return *this;
148 }
149
150 /**
151 * Exclude the hyper visor (i.e., only include events from the
152 * guest system).
153 *
154 * @warn This is attribute only seems to be ignored on Intel.
155 *
156 * @param val true to exclude host events
157 */
158 PerfKvmCounterConfig &exclude_hv(bool val) {
159 attr.exclude_hv = val;
160 return *this;
161 }
162
128 /** Underlying perf_event_attr structure describing the counter */
129 struct perf_event_attr attr;
130};
131
132/**
133 * An instance of a performance counter.
134 */
135class PerfKvmCounter

--- 213 unchanged lines hidden ---
163 /** Underlying perf_event_attr structure describing the counter */
164 struct perf_event_attr attr;
165};
166
167/**
168 * An instance of a performance counter.
169 */
170class PerfKvmCounter

--- 213 unchanged lines hidden ---