Re: constrain an app to one core?
Re: constrain an app to one core?
- Subject: Re: constrain an app to one core?
- From: Andrew Gallatin <email@hidden>
- Date: Sat, 31 Jan 2009 09:13:14 -0500
You can use utilBindThreadToCPU(). However, it requires the CHUD tools
kext be loaded, so it is not at all appropriate for a shipping product.
As somebody else said, it might be best to fix your bug.
Drew
PS: Here is a hack which binds a program to a CPU:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int cpu = atoi(argv[1]);
int ret;
chudInitialize();
printf("binding to cpu %d\n", cpu);
ret = utilBindThreadToCPU(cpu);
if (ret != 0) {
fprintf(stderr, "bind failed, return = %d\n", ret);
fprintf(stderr, "check that chud kext is installed\n");
fprintf(stderr, "and CPU %d is online\n", cpu);
exit(1);
}
execv(argv[2], &argv[2]);
return(0);
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden