$ bindcpu
--> displays the cpus bound to the current process
$ bindcpu mask-in-decimal command args...
--> execs command after binding it to the processors specified in mask.
Note that cpu bindings are inherited on fork().
#include <sys/prctl.h>
#include <stdio.h>
#include <unistd.h>
int main(int ac, char** av, char** ep)
{
if (ac == 1) {
unsigned long binding = 0;
prctl(PR_GET_CPUBINDING, &binding);
printf("CPU binding: %08lX\n", binding);
} else {
unsigned long binding = atoi(av[1]);
prctl(PR_SET_CPUBINDING, binding);
execve(av[2], av+2, ep);
}
return 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/