Go to the source code of this file.
|
| static long | sys_perf_event_open (struct perf_event_attr *hw_event, pid_t pid, int cpu, int group_fd, unsigned long flags) |
| |
| static unsigned long long | mmap_read_self (void *addr, unsigned long long *en, unsigned long long *ru) |
| |
| static uint64_t | mmap_read_head (pe_event_info_t *pe) |
| |
| static void | mmap_write_tail (pe_event_info_t *pe, uint64_t tail) |
| |
| static void | mmap_read (int cidx, ThreadInfo_t **thr, pe_event_info_t *pe, int profile_index) |
| |
◆ mmap_read()
Definition at line 223 of file perf_helpers.h.
227 uint64_t old = pe->
tail;
228 unsigned char *data = ((
unsigned char*)pe->
mmap_buf) + getpagesize();
233 SUBDBG(
"WARNING: failed to keep up with mmap data. head = %" PRIu64
234 ", tail = %" PRIu64
". Discarding samples.\n", head, old );
239 for( ; old != head; ) {
242 size_t size = event->
header.size;
246 if ( ( old & pe->
mask ) + size != ( ( old + size ) & pe->
mask ) ) {
248 uint64_t len =
min(
sizeof ( *event ), size ), cpy;
249 void *dst = &event_copy;
255 dst = ((
unsigned char*)dst) + cpy;
263 SUBDBG(
"event->type = %08x\n", event->header.type );
264 SUBDBG(
"event->size = %d\n", event->header.size );
266 switch ( event->header.type ) {
267 case PERF_RECORD_SAMPLE:
269 (
caddr_t ) (
unsigned long ) event->ip.ip,
273 case PERF_RECORD_LOST:
274 SUBDBG(
"Warning: because of a mmap buffer overrun, %" PRId64
275 " events were lost.\n" 276 "Loss was recorded when counter id %#"PRIx64
277 " overflowed.\n", event->lost.lost, event->lost.id );
280 SUBDBG(
"Error: unexpected header type - %d\n",
281 event->header.type );
struct perf_event_header header
#define SUBDBG(format, args...)
static void mmap_write_tail(pe_event_info_t *pe, uint64_t tail)
static uint64_t mmap_read_head(pe_event_info_t *pe)
◆ mmap_read_head()
Definition at line 179 of file perf_helpers.h.
181 struct perf_event_mmap_page *pc = pe->
mmap_buf;
185 PAPIERROR(
"perf_event_mmap_page is NULL" );
189 head = pc->data_head;
void PAPIERROR(char *format,...)
◆ mmap_read_self()
| static unsigned long long mmap_read_self |
( |
void * |
addr, |
|
|
unsigned long long * |
en, |
|
|
unsigned long long * |
ru |
|
) |
| |
|
inlinestatic |
◆ mmap_write_tail()
◆ sys_perf_event_open()
| static long sys_perf_event_open |
( |
struct perf_event_attr * |
hw_event, |
|
|
pid_t |
pid, |
|
|
int |
cpu, |
|
|
int |
group_fd, |
|
|
unsigned long |
flags |
|
) |
| |
|
static |
Definition at line 21 of file perf_helpers.h.
26 ret = syscall( __NR_perf_event_open,
27 hw_event,
pid, cpu, group_fd, flags );