Re: Clarification on support of arm32 with kernel4.1 for oprofile 1.2.0
Michael Petlan <[email protected]>
| Newsgroups | gmane.linux.oprofile |
|---|---|
| Message-ID | <alpine.LRH.2.20.1802141749380.25216@Diego> |
On Tue, 13 Feb 2018, Vinoth Natarajan wrote: > Hello Team, > Good Day!!! > > Cross Compiled the oprofile-1.2.0 in ubuntu. Hi, it's nice to see that you finally managed to compile it. [...] > > once compiled,tested the oprofile binaries in target (arm32 hw running on kernel-4.1) > Received the following error > > # operf > Your kernel does not implement a required syscall for the operf program. > > While checking found that CONFIG_PERF_EVENTS is not set, So enabled the same and tested the orpfile resulted the following error. > > > # operf --help > Your kernel's Performance Events Subsystem does not support your processor type. > > > if i change the oprofile-1.2.0 with oprofile 0.9.9 it works fine (oprofile running in legacy mode) > > Can anyone let me understand why oprofile-1.2.0 give " Your kernel's Performance Events Subsystem does not support your processor type. " error. I would first try to figure out whether the kernel subsystem works or not. Try to compile the attached hello.c and run it there. You need kernel-devel and headers. $ cc -o hello hello.c $ ./hello Measuring instruction count for this printf Used 3259 instructions Does this work for you? If yes, it's oprofile who has a problem, but it is pretty probable, that the problem lies in kernel backend. Cheers, Michael > > Is arm32 not supported in oprofile-1.2.0 with kernel -4.1? > > Please explain this !!! > > Thanks in Advance.. > > Thanks and Regards, > Vinoth Natarajan. > > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ oprofile-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/oprofile-list
hello.c
(text/plain, 2.2 KB)
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/ioctl.h>
#include <linux/perf_event.h>
#include <asm/unistd.h>
static long perf_event_open(struct perf_event_attr *hw_event, pid_t pid, int cpu, int group_fd, unsigned long flags)
{
int ret;
ret = syscall(__NR_perf_event_open, hw_event, pid, cpu, group_fd, flags);
return ret;
}
int main(int argc, char **argv)
{
struct perf_event_attr pe;
long long count;
int fd;
memset(&pe, 0, sizeof(struct perf_event_attr));
pe.type = PERF_TYPE_HARDWARE;
pe.size = sizeof(struct perf_event_attr);
pe.config = PERF_COUNT_HW_INSTRUCTIONS;
pe.disabled = 1;
pe.exclude_kernel = 1;
pe.exclude_hv = 1;
/*
int perf_event_open(struct perf_event_attr *attr, pid_t pid, int cpu, int group_fd, unsigned long flags);
attr
always a ptr to the struct
pid
3257 (process with that pid); needs the pid's process' rights
0 (this process)
-1 (all processes); needs root
cpu
0 (cpu 0)
-1 (all cpus)
group_fd
-1 if there are no groups
flag
probably can be 0
cpu == -1 && pid == -1 not compatible!!
examples:
perf_event_open(0x2337198, 3703, -1, -1, 0x8) = 3
perf stat -e cycles -p 3703
(one event, one process, all cpus)
perf_event_open(0x1d93198, -1, 0, -1, 0x8) = 3
perf_event_open(0x1d93198, -1, 1, -1, 0x8) = 4
perf_event_open(0x1d93198, -1, 2, -1, 0x8) = 5
perf_event_open(0x1d93198, -1, 3, -1, 0x8) = 7
perf stat -a -e cycles -- sleep 1
(one event, all processes, all cpus (need to be enumerated then))
perf_event_open(0x2492e60, -1, 0, -1, 0x8) = 3
perf stat -a -e uncore_cbox_0/clockticks/ -- sleep 1
(one event, all processes, seems that cpu 0 only is selected, but it's how perf does it)
*/
fd = perf_event_open(&pe, 0, -1, -1, 0);
if (fd == -1) {
fprintf(stderr, "Error opening leader %llx\n", pe.config);
exit(EXIT_FAILURE);
}
ioctl(fd, PERF_EVENT_IOC_RESET, 0);
ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);
printf("Measuring instruction count for this printf\n");
ioctl(fd, PERF_EVENT_IOC_DISABLE, 0);
read(fd, &count, sizeof(long long));
printf("Used %lld instructions\n", count);
close(fd);
}