Lines Matching refs:ts

59 static void throttle_do_leak(ThrottleState *ts, int64_t now)  in throttle_do_leak()  argument
62 int64_t delta_ns = now - ts->previous_leak; in throttle_do_leak()
65 ts->previous_leak = now; in throttle_do_leak()
73 throttle_leak_bucket(&ts->cfg.buckets[i], delta_ns); in throttle_do_leak()
142 static int64_t throttle_compute_wait_for(ThrottleState *ts, in throttle_compute_wait_for() argument
159 wait = throttle_compute_wait(&ts->cfg.buckets[index]); in throttle_compute_wait_for()
175 static bool throttle_compute_timer(ThrottleState *ts, in throttle_compute_timer() argument
183 throttle_do_leak(ts, now); in throttle_compute_timer()
186 wait = throttle_compute_wait_for(ts, direction); in throttle_compute_timer()
228 void throttle_init(ThrottleState *ts) in throttle_init() argument
230 memset(ts, 0, sizeof(ThrottleState)); in throttle_init()
231 throttle_config_init(&ts->cfg); in throttle_init()
396 void throttle_config(ThrottleState *ts, in throttle_config() argument
402 ts->cfg = *cfg; in throttle_config()
406 ts->cfg.buckets[i].level = 0; in throttle_config()
407 ts->cfg.buckets[i].burst_level = 0; in throttle_config()
410 ts->previous_leak = qemu_clock_get_ns(clock_type); in throttle_config()
418 void throttle_get_config(ThrottleState *ts, ThrottleConfig *cfg) in throttle_get_config() argument
420 *cfg = ts->cfg; in throttle_get_config()
432 bool throttle_schedule_timer(ThrottleState *ts, in throttle_schedule_timer() argument
445 must_wait = throttle_compute_timer(ts, in throttle_schedule_timer()
470 void throttle_account(ThrottleState *ts, ThrottleDirection direction, in throttle_account() argument
486 if (ts->cfg.op_size && size > ts->cfg.op_size) { in throttle_account()
487 units = (double) size / ts->cfg.op_size; in throttle_account()
493 bkt = &ts->cfg.buckets[bucket_types_size[direction][i]]; in throttle_account()
499 bkt = &ts->cfg.buckets[bucket_types_units[direction][i]]; in throttle_account()