Lines Matching +full:single +full:- +full:tt

4  * Copyright Nodalink, EURL. 2013-2014
12 * See the COPYING.LIB file in the top-level directory.
20 #include "qemu/error-report.h"
21 #include "qemu/main-loop.h"
23 #include "block/throttle-groups.h"
24 #include "system/block-backend.h"
31 static ThrottleTimers *tt; variable
36 return fabsl(x - y) < 1e-6; in double_cmp()
39 /* tests for single bucket operations */
136 g_assert(double_cmp(bkt.level, (i + 1) * (bkt.max - bkt.avg) / 10.0)); in test_compute_wait()
159 tt = &tgm.throttle_timers; in test_init()
163 memset(tt, 1, sizeof(*tt)); in test_init()
167 throttle_timers_init(tt, ctx, QEMU_CLOCK_VIRTUAL, in test_init()
171 g_assert(tt->clock_type == QEMU_CLOCK_VIRTUAL); in test_init()
172 g_assert(tt->timers[THROTTLE_READ]); in test_init()
173 g_assert(tt->timers[THROTTLE_WRITE]); in test_init()
184 throttle_timers_destroy(tt); in test_init()
191 tt = &tgm.throttle_timers; in test_init_readonly()
195 memset(tt, 1, sizeof(*tt)); in test_init_readonly()
199 throttle_timers_init(tt, ctx, QEMU_CLOCK_VIRTUAL, in test_init_readonly()
203 g_assert(tt->clock_type == QEMU_CLOCK_VIRTUAL); in test_init_readonly()
204 g_assert(tt->timers[THROTTLE_READ]); in test_init_readonly()
205 g_assert(!tt->timers[THROTTLE_WRITE]); in test_init_readonly()
216 throttle_timers_destroy(tt); in test_init_readonly()
223 tt = &tgm.throttle_timers; in test_init_writeonly()
227 memset(tt, 1, sizeof(*tt)); in test_init_writeonly()
231 throttle_timers_init(tt, ctx, QEMU_CLOCK_VIRTUAL, in test_init_writeonly()
235 g_assert(tt->clock_type == QEMU_CLOCK_VIRTUAL); in test_init_writeonly()
236 g_assert(!tt->timers[THROTTLE_READ]); in test_init_writeonly()
237 g_assert(tt->timers[THROTTLE_WRITE]); in test_init_writeonly()
248 throttle_timers_destroy(tt); in test_init_writeonly()
255 throttle_timers_init(tt, ctx, QEMU_CLOCK_VIRTUAL, in test_destroy()
257 throttle_timers_destroy(tt); in test_destroy()
259 g_assert(!tt->timers[i]); in test_destroy()
296 throttle_timers_init(tt, ctx, QEMU_CLOCK_VIRTUAL, in test_config_functions()
308 throttle_timers_destroy(tt); in test_config_functions()
362 set_cfg_value(false, i, -150); in test_enabled()
443 test_is_valid_for_value(-1, false); in test_is_valid()
459 b->avg = 0; in test_ranges()
464 b->avg = 1; in test_ranges()
467 b->avg = THROTTLE_VALUE_MAX; in test_ranges()
470 b->avg = THROTTLE_VALUE_MAX; in test_ranges()
471 b->max = THROTTLE_VALUE_MAX; in test_ranges()
475 b->avg = THROTTLE_VALUE_MAX + 1; in test_ranges()
478 b->avg = THROTTLE_VALUE_MAX; in test_ranges()
479 b->max = THROTTLE_VALUE_MAX + 1; in test_ranges()
483 b->avg = 1; in test_ranges()
484 b->max = 1; in test_ranges()
485 b->burst_length = 0; in test_ranges()
488 b->avg = 1; in test_ranges()
489 b->max = 1; in test_ranges()
490 b->burst_length = 1; in test_ranges()
493 b->avg = 1; in test_ranges()
494 b->max = 1; in test_ranges()
495 b->burst_length = THROTTLE_VALUE_MAX; in test_ranges()
498 b->avg = 1; in test_ranges()
499 b->max = 1; in test_ranges()
500 b->burst_length = THROTTLE_VALUE_MAX + 1; in test_ranges()
504 b->avg = 1; in test_ranges()
505 b->max = 2; in test_ranges()
506 b->burst_length = THROTTLE_VALUE_MAX / 2; in test_ranges()
509 b->avg = 1; in test_ranges()
510 b->max = 3; in test_ranges()
511 b->burst_length = THROTTLE_VALUE_MAX / 2; in test_ranges()
514 b->avg = 1; in test_ranges()
515 b->max = THROTTLE_VALUE_MAX; in test_ranges()
516 b->burst_length = 1; in test_ranges()
519 b->avg = 1; in test_ranges()
520 b->max = THROTTLE_VALUE_MAX; in test_ranges()
521 b->burst_length = 2; in test_ranges()
566 memset(tt, 0, sizeof(*tt)); in test_have_timer()
569 g_assert(!throttle_timers_are_initialized(tt)); in test_have_timer()
573 throttle_timers_init(tt, ctx, QEMU_CLOCK_VIRTUAL, in test_have_timer()
577 g_assert(throttle_timers_are_initialized(tt)); in test_have_timer()
579 throttle_timers_destroy(tt); in test_have_timer()
586 memset(tt, 0, sizeof(*tt)); in test_detach_attach()
590 throttle_timers_init(tt, ctx, QEMU_CLOCK_VIRTUAL, in test_detach_attach()
594 g_assert(throttle_timers_are_initialized(tt)); in test_detach_attach()
597 throttle_timers_detach_aio_context(tt); in test_detach_attach()
598 g_assert(!throttle_timers_are_initialized(tt)); in test_detach_attach()
601 throttle_timers_attach_aio_context(tt, ctx); in test_detach_attach()
602 g_assert(throttle_timers_are_initialized(tt)); in test_detach_attach()
604 throttle_timers_destroy(tt); in test_detach_attach()
634 throttle_timers_init(tt, ctx, QEMU_CLOCK_VIRTUAL, in do_test_accounting()
661 throttle_timers_destroy(tt); in do_test_accounting()
753 tgm1 = &blkp1->throttle_group_member; in test_groups()
754 tgm2 = &blkp2->throttle_group_member; in test_groups()
755 tgm3 = &blkp3->throttle_group_member; in test_groups()
757 g_assert(tgm1->throttle_state == NULL); in test_groups()
758 g_assert(tgm2->throttle_state == NULL); in test_groups()
759 g_assert(tgm3->throttle_state == NULL); in test_groups()
765 g_assert(tgm1->throttle_state != NULL); in test_groups()
766 g_assert(tgm2->throttle_state != NULL); in test_groups()
767 g_assert(tgm3->throttle_state != NULL); in test_groups()
771 g_assert(tgm1->throttle_state == tgm3->throttle_state); in test_groups()
799 g_assert(tgm1->throttle_state == NULL); in test_groups()
800 g_assert(tgm2->throttle_state == NULL); in test_groups()
801 g_assert(tgm3->throttle_state == NULL); in test_groups()