Arjun Suresh (talk | contribs) |
Arjun Suresh (talk | contribs) |
||
Line 5: | Line 5: | ||
1. Load the driver | 1. Load the driver | ||
static int loadDriver() | static int loadDriver() | ||
− | { | + | { |
int fd; | int fd; | ||
fd = open("/dev/" DEV_NAME, O_RDWR); | fd = open("/dev/" DEV_NAME, O_RDWR); | ||
Line 12: | Line 12: | ||
} | } | ||
return fd; | return fd; | ||
− | } | + | } |
2. Send sata to driver | 2. Send sata to driver | ||
ioctl(fd, IOCTL_MSR_CMDS, (long long)msr_start); | ioctl(fd, IOCTL_MSR_CMDS, (long long)msr_start); |
Download and install File:Pmcdriver.zip This install the kernel driver msrdrv which contains all the system calls needed for reading the performance monitoring counters in Intel machines.
So, in the user program just do the following: 1. Load the driver
static int loadDriver() { int fd; fd = open("/dev/" DEV_NAME, O_RDWR); if (fd == -1) { perror("Failed to open /dev/" DEV_NAME); } return fd; }
2. Send sata to driver ioctl(fd, IOCTL_MSR_CMDS, (long long)msr_start);
Download and install File:Pmcdriver.zip This install the kernel driver msrdrv which contains all the system calls needed for reading the performance monitoring counters in Intel machines.
So, in the user program just do the following: 1. Load the driver
static int loadDriver()
{
int fd; fd = open("/dev/" DEV_NAME, O_RDWR); if (fd == -1) { perror("Failed to open /dev/" DEV_NAME); } return fd;
} 2. Send sata to driver ioctl(fd, IOCTL_MSR_CMDS, (long long)msr_start);