igt/gem_gtt_hog: Convert opencoded fork()/wait() over to igt_fork()

No reason not to use the common infrastructure here.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2014-07-26 11:42:20 +01:00
parent a54faca987
commit 3309f54e8f

View File

@ -150,7 +150,6 @@ static void run(data_t *data, int child)
munmap(ptr, size);
igt_assert(x == canary);
exit(0);
}
igt_simple_main
@ -158,7 +157,6 @@ igt_simple_main
struct timeval start, end;
pid_t children[64];
data_t data = {};
int n;
/* check for an intel gpu before goint nuts. */
int fd = drm_open_any();
@ -171,22 +169,11 @@ igt_simple_main
data.intel_gen = intel_gen(data.devid);
gettimeofday(&start, NULL);
for (n = 0; n < ARRAY_SIZE(children); n++) {
switch ((children[n] = fork())) {
case -1: igt_assert(0);
case 0: run(&data, n); break;
default: break;
}
}
for (n = 0; n < ARRAY_SIZE(children); n++) {
int status = -1;
while (waitpid(children[n], &status, 0) == -1 &&
errno == -EINTR)
;
igt_assert(status == 0);
}
igt_fork(child, ARRAY_SIZE(children))
run(&data, child);
igt_waitchildren();
gettimeofday(&end, NULL);
igt_info("Time to execute %lu children: %7.3fms\n",
ARRAY_SIZE(children), elapsed(&start, &end) / 1000);
}