diff options
author | Nix <nix@esperi.org.uk> | 2010-02-08 13:16:00 -0500 |
---|---|---|
committer | Søren Sandmann Pedersen <sandmann@daimi.au.dk> | 2010-02-08 13:16:00 -0500 |
commit | 106a734c4fea4d19cb705d773eedffc255c38919 (patch) | |
tree | 04f0d96f3d1febe78d11bd93821b2a4948a47e66 | |
parent | 3e4921b92dbf40a5e8412539898f22b6eacc3816 (diff) |
Wire up __NR_perf_counter_open syscall for almost all arches as of
Currently, sysprof hardwires the syscall number of
__NR_perf_counter_open. That's all very well, except... like other
syscall numbers, it varies per-arch. With a few exceptions
(e.g. sparc64), it even varies between 32-bit and 64-bit x86 arches.
This patch provides the defines for every number I could see assigned
in git trunk right now, with the exception of some of the ARM ones, where
I couldn't see how to differentiate between the various sorts of ARM to
figure out what the syscall base was. For those, let's wait for libc to
catch up.
The only arch I've been unable even to guess at is the very new S-Core,
which is the only user so far of the generic syscall table in
<include/asm-generic>. This specifies a value of 241, but I can't hook
it up because I can't find an S-Core toolchain anywhere so I don't know
what #define to check for, and googling gives no clues.
Only tested on x86-64 (where it now works) so there may be all sorts of
bugs in the rest of it (well, in the #defines anyway, though most were
checked against GCC trunk).
-rw-r--r-- | collector.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/collector.c b/collector.c index b39fbc0..5f50ce0 100644 --- a/collector.c +++ b/collector.c @@ -149,9 +149,43 @@ sysprof_perf_counter_open (struct perf_counter_attr *attr, unsigned long flags) { #ifndef __NR_perf_counter_open +#if defined(__i386__) #define __NR_perf_counter_open 336 +#elif defined(__x86_64__) +#define __NR_perf_counter_open 298 +#elif defined(__arm__) +#define __NR_perf_counter_open 364 +#elif defined(__bfin__) +#define __NR_perf_counter_open 369 +#elif defined(__frv__) +#define __NR_perf_counter_open 336 +#elif defined(__m68k__) +#define __NR_perf_counter_open 332 +#elif defined(__MICROBLAZE__) +#define __NR_perf_counter_open 366 +#elif defined(__mips__) && defined(_ABIO32) +#define __NR_perf_counter_open 4333 +#elif defined(__mips__) && defined(_ABIN32) +#define __NR_perf_counter_open 6296 +#elif defined(__mips__) && defined(_ABI64) +#define __NR_perf_counter_open 5292 +#elif defined(__mn10300__) +#define __NR_perf_counter_open 337 +#elif defined(__hppa__) +#define __NR_perf_counter_open 318 +#elif defined(__ppc__) || defined(__ppc64__) +#define __NR_perf_counter_open 319 +#elif defined(__s390__) +#define __NR_perf_counter_open 331 +#elif defined(__sh__) && (!defined(__SH5__) || __SH5__ == 32) +#define __NR_perf_counter_open 336 +#elif defined(__sh__) && defined(__SH5__) && __SH5__ == 64 +#define __NR_perf_counter_open 364 +#elif defined(__sparc__) || defined(__sparc64__) +#define __NR_perf_counter_open 327 #endif - +#endif + attr->size = sizeof(*attr); return syscall (__NR_perf_counter_open, attr, pid, cpu, group_fd, flags); |