perror("parse command line failed"), exit(EXIT_FAILURE);
if (val != getprio(0))
if (setprio(0, val) == -1)
perror("priority isn't a valid"), exit(EXIT_FAILURE);
break;
case 'n':
if (sscanf(optarg, "%i", &val) != 1)
perror("parse command line failed"), exit(EXIT_FAILURE);
if (val > 0) nsingl *= val;
break;
case 'a':
if (sscanf(optarg, "%i", &val) != 1)
perror("parse command line failed"), exit(EXIT_FAILURE);
if (val > 0) nall = val;
break;
default:
exit(EXIT_FAILURE);
}
}
// ... вот здесь начинается собственно сама программа.
if (nthr > 1)
cout << "Multi-thread evaluation, thread number = " << nthr;
else cout << "Single-thread evaluation";
cout << " , priority level: " << getprio(0) << endl;
__clockperiod clcout;
ClockPeriod(CLOCK_REALTIME, NULL, &clcout, 0);
// интервал диспетчеризации - 4 периода tickslice
// (системного тика):
cout << "rescheduling = \t"
<< clcout.nsec * 4 / 1000000. << endl;