Lines Matching +full:max +full:- +full:functions
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"
36 return fabsl(x - y) < 1e-6; in double_cmp()
47 bkt.max = 15; in test_leak_bucket()
53 g_assert(bkt.max == 15); in test_leak_bucket()
59 g_assert(bkt.max == 15); in test_leak_bucket()
65 g_assert(bkt.max == 15); in test_leak_bucket()
70 bkt.max = 250; in test_leak_bucket()
96 bkt.max = 15; in test_compute_wait()
103 bkt.max = 15; in test_compute_wait()
110 bkt.max = 15; in test_compute_wait()
115 /* half an operation above max */ in test_compute_wait()
117 bkt.max = 15; in test_compute_wait()
124 /* Perform I/O for 2.2 seconds at a rate of bkt.max */ in test_compute_wait()
128 bkt.max = 200; in test_compute_wait()
130 double units = bkt.max / 10.0; in test_compute_wait()
136 g_assert(double_cmp(bkt.level, (i + 1) * (bkt.max - bkt.avg) / 10.0)); in test_compute_wait()
146 /* functions to test ThrottleState initialization/destroy methods */
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()
180 g_assert(!ts.cfg.buckets[i].max); in test_init()
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()
212 g_assert(!ts.cfg.buckets[i].max); in test_init_readonly()
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()
244 g_assert(!ts.cfg.buckets[i].max); in test_init_writeonly()
259 g_assert(!tt->timers[i]); in test_destroy()
277 orig_cfg.buckets[THROTTLE_BPS_TOTAL].max = 0; in test_config_functions()
278 orig_cfg.buckets[THROTTLE_BPS_READ].max = 56; in test_config_functions()
279 orig_cfg.buckets[THROTTLE_BPS_WRITE].max = 120; in test_config_functions()
281 orig_cfg.buckets[THROTTLE_OPS_TOTAL].max = 150; in test_config_functions()
282 orig_cfg.buckets[THROTTLE_OPS_READ].max = 400; in test_config_functions()
283 orig_cfg.buckets[THROTTLE_OPS_WRITE].max = 500; in test_config_functions()
318 g_assert(final_cfg.buckets[THROTTLE_BPS_TOTAL].max == 0); in test_config_functions()
319 g_assert(final_cfg.buckets[THROTTLE_BPS_READ].max == 56); in test_config_functions()
320 g_assert(final_cfg.buckets[THROTTLE_BPS_WRITE].max == 120); in test_config_functions()
322 g_assert(final_cfg.buckets[THROTTLE_OPS_TOTAL].max == 150); in test_config_functions()
323 g_assert(final_cfg.buckets[THROTTLE_OPS_READ].max == 400); in test_config_functions()
324 g_assert(final_cfg.buckets[THROTTLE_OPS_WRITE].max == 500); in test_config_functions()
334 /* functions to test is throttle is enabled by a config */
338 cfg.buckets[index].max = value; in set_cfg_value()
339 /* If max is set, avg should never be 0 */ in set_cfg_value()
340 cfg.buckets[index].avg = MAX(cfg.buckets[index].avg, 1); in set_cfg_value()
362 set_cfg_value(false, i, -150); in test_enabled()
367 /* tests functions for throttle_conflicting */
427 /* functions to test the throttle_is_valid function */
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()
503 /* burst_length * max cannot exceed THROTTLE_VALUE_MAX */ 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()
532 cfg.buckets[i].max = 100; in test_max_is_missing_limit()
536 cfg.buckets[i].max = 0; in test_max_is_missing_limit()
540 cfg.buckets[i].max = 0; in test_max_is_missing_limit()
544 cfg.buckets[i].max = 30; in test_max_is_missing_limit()
548 cfg.buckets[i].max = 100; in test_max_is_missing_limit()
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()
827 g_test_add_func("/throttle/config/max", test_max_is_missing_limit); in main()