| 1 | /* |
| 2 | * Dirty page rate limit common functions |
| 3 | * |
| 4 | * Copyright (c) 2022 CHINA TELECOM CO.,LTD. |
| 5 | * |
| 6 | * Authors: |
| 7 | * Hyman Huang(黄勇) <huangy81@chinatelecom.cn> |
| 8 | * |
| 9 | * This work is licensed under the terms of the GNU GPL, version 2 or later. |
| 10 | * See the COPYING file in the top-level directory. |
| 11 | */ |
| 12 | #ifndef QEMU_DIRTYRLIMIT_H |
| 13 | #define QEMU_DIRTYRLIMIT_H |
| 14 | |
| 15 | #define DIRTYLIMIT_CALC_TIME_MS 1000 /* 1000ms */ |
| 16 | |
| 17 | int64_t vcpu_dirty_rate_get(int cpu_index); |
| 18 | void vcpu_dirty_rate_stat_start(void); |
| 19 | void vcpu_dirty_rate_stat_stop(void); |
| 20 | void vcpu_dirty_rate_stat_initialize(void); |
| 21 | void vcpu_dirty_rate_stat_finalize(void); |
| 22 | |
| 23 | void dirtylimit_state_lock(void); |
| 24 | void dirtylimit_state_unlock(void); |
| 25 | void dirtylimit_state_initialize(void); |
| 26 | void dirtylimit_state_finalize(void); |
| 27 | bool dirtylimit_in_service(void); |
| 28 | bool dirtylimit_vcpu_index_valid(int cpu_index); |
| 29 | void dirtylimit_process(void); |
| 30 | void dirtylimit_change(bool start); |
| 31 | void dirtylimit_set_vcpu(int cpu_index, |
| 32 | uint64_t quota, |
| 33 | bool enable); |
| 34 | void dirtylimit_set_all(uint64_t quota, |
| 35 | bool enable); |
| 36 | void dirtylimit_vcpu_execute(CPUState *cpu); |
| 37 | uint64_t dirtylimit_throttle_time_per_round(void); |
| 38 | uint64_t dirtylimit_ring_full_time(void); |
| 39 | #endif |