Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added NetBSD processor affinity support. #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yazshel
Copy link

@yazshel yazshel commented Dec 18, 2015

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:

  • 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?
Verifying sleep_10000_micro...
Failed sleep_10000_micro. Expected: 10000 microsecs. Actual: 20018 microsecs.
-------------
Verifying sleep_20000_micro...
Failed sleep_20000_micro. Expected: 20000 microsecs. Actual: 29949 microsecs.
-------------
Verifying sleep_50000_micro...
OK: sleep_50000_micro
-------------

Let me know if there is anything else you'd like me to change as part of this pull request.

Cheers,

Timshel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant