split out the page dirtying to its own file.
[trinity.git] / perf.c
blobeb1b4aa7c1b35abdbf20cd61100e20242e616979
1 #include <errno.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5 #include <unistd.h>
6 //#include <sys/syscall.h> /* For SYS_xxx definitions */
7 #include <asm/unistd.h>
9 #include "perf.h"
10 #include "shm.h"
11 #include "log.h"
12 #include "sanitise.h"
14 void open_perf_fds(void)
16 struct syscallrecord* sc;
17 unsigned int i = 0;
19 while (i < MAX_PERF_FDS) {
20 int fd;
22 sanitise_perf_event_open(0);
23 sc = &shm->syscall[0];
24 fd = syscall(__NR_perf_event_open, sc->a1, sc->a2, sc->a3, sc->a4, sc->a5);
25 if (fd != -1) {
26 shm->perf_fds[i] = fd;
27 output(2, "fd[%d] = perf\n", shm->perf_fds[i]);
28 i++;
29 } else {
30 if (errno == ENOSYS)
31 return;