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
283 uint64_t
read()
const;
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;
void detach()
Detach a counter from PerfEvent.
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.
uint64_t read() const
Read the current value of a counter.
PerfKvmCounter()
Create a new counter, but don't attach it.
struct perf_event_mmap_page * ringBuffer
Memory mapped PerfEvent sample ring buffer.
int fcntl(int cmd, void *p1)
void enableSignals(pid_t tid, int signal)
Enable signal delivery to a thread on counter overflow.
int fd
PerfEvent file descriptor associated with counter.
pid_t gettid()
Get the TID of the current thread.
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...
PerfKvmCounter & operator=(const PerfKvmCounter &that)
void refresh(int refresh)
Enable a counter for a fixed number of events.
PerfKvmCounterConfig(uint32_t type, uint64_t config)
Initialize PerfEvent counter configuration structure.
void mmapPerf(int pages)
MMAP the PerfEvent file descriptor.
void period(uint64_t period)
Update the period of an overflow counter.
int ringNumPages
Total number of pages in ring buffer.
PerfKvmCounterConfig & samplePeriod(uint64_t period)
Set the initial sample period (overflow count) of an event.
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.
int ioctl(int request, long p1)
PerfEvent ioctl interface.
void stop()
Stop counting.
void start()
Start counting.
bool attached() const
Check if a counter is attached.
int fcntl(int cmd, long p1)
PerfEvent fnctl interface.
void enableSignals(int signal)
Enable signal delivery on counter overflow.