Lines Matching defs:test

64 	struct ot_test *test; /* test parameters */
85 static void *ot_kzalloc(struct ot_test *test, long size)
90 atomic_long_add(size, &test->data.kmalloc.alloc);
94 static void ot_kfree(struct ot_test *test, void *ptr, long size)
98 atomic_long_add(size, &test->data.kmalloc.free);
102 static void ot_mem_report(struct ot_test *test)
106 pr_info("memory allocation summary for %s\n", test->name);
108 alloc = atomic_long_read(&test->data.kmalloc.alloc);
109 free = atomic_long_read(&test->data.kmalloc.free);
112 alloc = atomic_long_read(&test->data.vmalloc.alloc);
113 free = atomic_long_read(&test->data.vmalloc.free);
128 struct ot_test *test; /* test parameters */
159 struct ot_test *test = item->test;
161 if (atomic_read_acquire(&test->data.stop))
173 if (!item->test->hrtimer)
180 if (!item->test->hrtimer)
199 struct ot_test *test,
205 item->test = test;
208 item->bulk[0] = test->bulk_normal;
209 item->bulk[1] = test->bulk_irq;
210 item->delay = test->delay;
213 ot_init_hrtimer(item, item->test->hrtimer);
220 struct ot_test *test = item->test;
223 atomic_inc(&test->data.nthreads);
224 down_read(&test->data.start);
225 up_read(&test->data.start);
229 if (atomic_read_acquire(&test->data.stop))
236 if (atomic_dec_and_test(&test->data.nthreads))
237 complete(&test->data.wait);
242 static void ot_perf_report(struct ot_test *test, u64 duration)
248 pr_info("Testing summary for %s\n", test->name);
276 test->data.objects = total;
277 test->data.duration = duration;
281 * synchronous test cases for objpool manipulation
285 static struct ot_context *ot_init_sync_m0(struct ot_test *test)
291 sop = (struct ot_context *)ot_kzalloc(test, sizeof(*sop));
294 sop->test = test;
295 if (test->objsz < 512)
298 if (objpool_init(&sop->pool, max, test->objsz,
300 ot_kfree(test, sop, sizeof(*sop));
311 ot_kfree(sop->test, sop, sizeof(*sop));
322 * synchronous test cases: performance mode
348 static int ot_start_sync(struct ot_test *test)
357 sop = g_ot_sync_ops[test->mode].init(test);
362 down_write(&test->data.start);
368 ot_init_cpu_item(item, test, &sop->pool, ot_bulk_sync);
388 if (atomic_dec_and_test(&test->data.nthreads))
389 complete(&test->data.wait);
395 up_write(&test->data.start);
398 timeout = msecs_to_jiffies(test->duration);
402 atomic_set_release(&test->data.stop, 1);
405 wait_for_completion(&test->data.wait);
409 g_ot_sync_ops[test->mode].fini(sop);
412 ot_perf_report(test, duration);
415 ot_mem_report(test);
421 * asynchronous test cases: pool lifecycle controlled by refcount
427 struct ot_test *test = sop->test;
429 /* here all cpus are aware of the stop event: test->data.stop = 1 */
430 WARN_ON(!atomic_read_acquire(&test->data.stop));
433 complete(&test->data.rcu);
450 ot_kfree(sop->test, sop, sizeof(*sop));
455 static struct ot_context *ot_init_async_m0(struct ot_test *test)
461 sop = (struct ot_context *)ot_kzalloc(test, sizeof(*sop));
464 sop->test = test;
465 if (test->objsz < 512)
468 if (objpool_init(&sop->pool, max, test->objsz, gfp, sop,
470 ot_kfree(test, sop, sizeof(*sop));
507 struct ot_test *test = item->test;
520 stop = atomic_read_acquire(&test->data.stop);
539 static int ot_start_async(struct ot_test *test)
548 sop = g_ot_async_ops[test->mode].init(test);
553 down_write(&test->data.start);
559 ot_init_cpu_item(item, test, &sop->pool, ot_bulk_async);
579 if (atomic_dec_and_test(&test->data.nthreads))
580 complete(&test->data.wait);
584 up_write(&test->data.start);
587 timeout = msecs_to_jiffies(test->duration);
591 atomic_set_release(&test->data.stop, 1);
594 g_ot_async_ops[test->mode].fini(sop);
597 wait_for_completion(&test->data.wait);
601 wait_for_completion(&test->data.rcu);
609 ot_perf_report(test, duration);
612 ot_mem_report(test);
624 * duration: int, total test time in ms
629 * name: char *, tag for current test ot_item