40 #ifndef __CPU_KVM_PERFEVENT_HH__ 41 #define __CPU_KVM_PERFEVENT_HH__ 43 #include <linux/perf_event.h> 44 #include <sys/types.h> 48 #include "config/have_perf_attr_exclude_host.hh" 89 attr.sample_period = period;
102 attr.wakeup_events = events;
144 #if HAVE_PERF_ATTR_EXCLUDE_HOST == 1 207 attach(config, tid, -1);
223 attach(config, tid, parent.
fd);
264 void period(uint64_t period);
278 void refresh(
int refresh);
283 uint64_t read()
const;
291 void enableSignals(pid_t tid,
int signal);
329 void mmapPerf(
int pages);
341 int fcntl(
int cmd,
long p1);
342 int fcntl(
int cmd,
void *p1) {
return fcntl(cmd, (
long)p1); }
355 int ioctl(
int request,
long p1);
356 int ioctl(
int request,
void *p1) {
return ioctl(request, (
long)p1); }
366 void read(
void *buf,
size_t size)
const;
int ioctl(int request, void *p1)
PerfKvmCounterConfig & pinned(bool val)
Force the group to be on the active all the time (i.e., disallow multiplexing).
long pageSize
Cached host page size.
struct perf_event_attr attr
Underlying perf_event_attr structure describing the counter.
struct perf_event_mmap_page * ringBuffer
Memory mapped PerfEvent sample ring buffer.
int fcntl(int cmd, void *p1)
int fd
PerfEvent file descriptor associated with counter.
void attach(PerfKvmCounterConfig &config, pid_t tid, const PerfKvmCounter &parent)
Attach a counter and make it a member of an existing counter group.
PerfKvmCounterConfig & wakeupEvents(uint32_t events)
Set the number of samples that need to be triggered before reporting data as being available on the p...
PerfKvmCounterConfig(uint32_t type, uint64_t config)
Initialize PerfEvent counter configuration structure.
int ringNumPages
Total number of pages in ring buffer.
PerfKvmCounterConfig & samplePeriod(uint64_t period)
Set the initial sample period (overflow count) of an event.
bool attached() const
Check if a counter is attached.
An instance of a performance counter.
void attach(PerfKvmCounterConfig &config, pid_t tid)
Attach a counter.
PerfKvmCounterConfig & exclude_host(bool val)
Exclude the events from the host (i.e., only include events from the guest system).
PerfKvmCounterConfig & disabled(bool val)
Don't start the performance counter automatically when attaching it.
PerfKvmCounterConfig & exclude_hv(bool val)
Exclude the hyper visor (i.e., only include events from the guest system).
PerfEvent counter configuration.
void enableSignals(int signal)
Enable signal delivery on counter overflow.