int mode = 0;
int nb = 1000;
int nb_cores = 0;
+int proc = 0;
char *output = NULL;
extern char *message;
int usage (int ret)
{
FILE *fd = ret ? stderr : stdout;
- fprintf (fd, "usage: %s [-a int] [-b int] [-d int] [-e int] [-h] [-k int] [-m int] [-n int] [-o file] [-s]\n", progname);
+ fprintf (fd, "usage: %s [-a int] [-b int] [-d int] [-e int] [-h] [-k int] [-m int] [-n int] [-o file] [-p int] [-s]\n", progname);
fprintf (fd, " -a: avoid aberrand valies (%g%%)\n", abe_per);
fprintf (fd, " -d: delay process start for (%ds)\n", delay);
fprintf (fd, " -b: nb bins for histogram (%d)\n", hist_bin);
fprintf (fd, " -m: 0 for threads, 1 ping-pong process, 2 ping process, 3 pong process (%d)\n", mode);
fprintf (fd, " -n: nb measurements (%d)\n", nb);
fprintf (fd, " -o: output raw data (%s)\n", (output) ? output : "none");
+ fprintf (fd, " -p: processor (%d)\n", proc);
fprintf (fd, " -s: display statistics (%s)\n", (do_stat) ? "yes" : "no");
if (usage_ext) {
fprintf (fd, "extension:\n");
void *launch (void *arg)
{
launch_param_t *param = (launch_param_t *)arg;
+ cpu_set_t cpu_mask;
+ if (sched_getaffinity (0, sizeof (cpu_set_t), &cpu_mask) != 0) {
+ fprintf (stderr, "error: sched_getaffinity\n");
+ RETURN (mode, 1);
+ }
+ int nbcores = CPU_COUNT(&cpu_mask);
int cpu = (nb_cores == 1) ? 0 : (nb_cores == 2) ? param->target : -1;
if (cpu != -1) {
- cpu_set_t cpu_mask;
+ cpu = (proc + cpu) % nbcores;
CPU_ZERO (&cpu_mask);
CPU_SET (cpu, &cpu_mask);
if (sched_setaffinity (0, sizeof (cpu_set_t), &cpu_mask) != 0) {
}
output = arg;
break;
+ case 'p':
+ arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
+ if (arg == NULL) {
+ fprintf (stderr, "%s: processor id not specified\n", progname);
+ return usage (1);
+ }
+ proc = atoi (arg);
+ break;
case 's':
do_stat = 1;
break;