hw/nvram: Always register FW_CFG_DATA_GENERATOR_INTERFACE
[qemu/ar7.git] / include / sysemu / cpu-throttle.h
blobd65bdef6d030c19bed65a9ddab42df2be48fcd1e
1 /*
2 * Copyright (c) 2012 SUSE LINUX Products GmbH
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see
16 * <http://www.gnu.org/licenses/gpl-2.0.html>
19 #ifndef SYSEMU_CPU_THROTTLE_H
20 #define SYSEMU_CPU_THROTTLE_H
22 #include "qemu/timer.h"
24 /**
25 * cpu_throttle_init:
27 * Initialize the CPU throttling API.
29 void cpu_throttle_init(void);
31 /**
32 * cpu_throttle_set:
33 * @new_throttle_pct: Percent of sleep time. Valid range is 1 to 99.
35 * Throttles all vcpus by forcing them to sleep for the given percentage of
36 * time. A throttle_percentage of 25 corresponds to a 75% duty cycle roughly.
37 * (example: 10ms sleep for every 30ms awake).
39 * cpu_throttle_set can be called as needed to adjust new_throttle_pct.
40 * Once the throttling starts, it will remain in effect until cpu_throttle_stop
41 * is called.
43 void cpu_throttle_set(int new_throttle_pct);
45 /**
46 * cpu_throttle_stop:
48 * Stops the vcpu throttling started by cpu_throttle_set.
50 void cpu_throttle_stop(void);
52 /**
53 * cpu_throttle_active:
55 * Returns: %true if the vcpus are currently being throttled, %false otherwise.
57 bool cpu_throttle_active(void);
59 /**
60 * cpu_throttle_get_percentage:
62 * Returns the vcpu throttle percentage. See cpu_throttle_set for details.
64 * Returns: The throttle percentage in range 1 to 99.
66 int cpu_throttle_get_percentage(void);
68 #endif /* SYSEMU_CPU_THROTTLE_H */