test75: force child to use a minimum of cpu time
test75 sometimes false-fails if something else is going on at the same time, presumably because the child doesn't spin enough to register a nonzero getrusage() cpu time value, as spin() uses the real time to limit the spinning. this change forces spin() to do a minimum amount of spinning before exiting, regardless of scheduling. Change-Id: I57c63d22969bba418f36bcc8c5ace2b6fb445968
This commit is contained in:
parent
b50dbb4d24
commit
b2dcc910d4
1 changed files with 4 additions and 4 deletions
|
@ -28,20 +28,20 @@ static void spin()
|
||||||
{
|
{
|
||||||
struct timeval start_time;
|
struct timeval start_time;
|
||||||
struct timeval end_time;
|
struct timeval end_time;
|
||||||
int loop = 0;
|
unsigned int loop = 0;
|
||||||
if (gettimeofday(&start_time, NULL) == -1) {
|
if (gettimeofday(&start_time, NULL) == -1) {
|
||||||
e(1);
|
e(1);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
memset(&end_time, 0, sizeof(end_time));
|
memset(&end_time, 0, sizeof(end_time));
|
||||||
while (start_time.tv_sec + 10 > end_time.tv_sec) {
|
do {
|
||||||
if ((++loop % 10000) == 0) {
|
if ((++loop % 3000000000) == 0) {
|
||||||
if (gettimeofday(&end_time, NULL) == -1) {
|
if (gettimeofday(&end_time, NULL) == -1) {
|
||||||
e(1);
|
e(1);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} while (start_time.tv_sec + 10 > end_time.tv_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in a new issue