I've added processor affinity support for NetBSD to xhprof. I've tested the changes on Linux and MacOS but not FreeBSD (as I don't currently have have access to a FreeBSD box).
A couple of notes:
In the GET_AFFINITY / SET_AFFINITY macros, I'm ignoring pid and calling pthread_self() instead. It's only ever currently called with a pid argument of 0 (ie. self) anyway...
I've changed all direct references to cpu_set_t to be pointers, and are allocating memory for the cpu_set_t/cpuset_t structure. This is because on NetBSD, the cpuset_t structure is declared but not defined in the headers. NetBSD provides cpuset_* functions to create, manipulate and sizeof cpuset_t structures.
There is currently one test failing on NetBSD ... I'm not sure that it's related to the processor affinity stuff though. It's tests/xhprof_005 an it fails with the following output. Without a good understanding of how the usleep stuff works, I'm a bit unsure of what might be going on here; any ideas?
Hi,
I've added processor affinity support for NetBSD to xhprof. I've tested the changes on Linux and MacOS but not FreeBSD (as I don't currently have have access to a FreeBSD box).
A couple of notes:
GET_AFFINITY
/SET_AFFINITY
macros, I'm ignoringpid
and callingpthread_self()
instead. It's only ever currently called with apid
argument of 0 (ie. self) anyway...cpu_set_t
to be pointers, and are allocating memory for thecpu_set_t
/cpuset_t
structure. This is because on NetBSD, thecpuset_t
structure is declared but not defined in the headers. NetBSD providescpuset_*
functions to create, manipulate and sizeofcpuset_t
structures.tests/xhprof_005
an it fails with the following output. Without a good understanding of how the usleep stuff works, I'm a bit unsure of what might be going on here; any ideas?Let me know if there is anything else you'd like me to change as part of this pull request.
Cheers,
Timshel