diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-07-26 11:42:20 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-09-03 12:03:56 +0100 |
commit | 3309f54e8f15d2d82544b00abff2215f50ca27b2 (patch) | |
tree | 658ae3c2955594433a29dd66db8c57bdedab2637 /tests/gem_gtt_hog.c | |
parent | a54faca98717eda0e192139bd72f110bd5a98c90 (diff) |
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>
Diffstat (limited to 'tests/gem_gtt_hog.c')
-rw-r--r-- | tests/gem_gtt_hog.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/tests/gem_gtt_hog.c b/tests/gem_gtt_hog.c index 5d475400..9f1b4f6c 100644 --- a/tests/gem_gtt_hog.c +++ b/tests/gem_gtt_hog.c @@ -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); } |