^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* cpufreq-bench CPUFreq microbenchmark
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2008 Christian Kornacker <ckornacker@suse.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) /* struct that holds the required config parameters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) struct config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) long sleep; /* sleep time in µs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) long load; /* load time in µs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) long sleep_step; /* time value which changes the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * sleep time after every round in µs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) long load_step; /* time value which changes the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * load time after every round in µs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) unsigned int cycles; /* calculation cycles with the same sleep/load time */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) unsigned int rounds; /* calculation rounds with iterated sleep/load time */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) unsigned int cpu; /* cpu for which the affinity is set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) char governor[15]; /* cpufreq governor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) enum sched_prio /* possible scheduler priorities */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) SCHED_ERR = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) SCHED_HIGH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) SCHED_DEFAULT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) SCHED_LOW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) } prio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) unsigned int verbose; /* verbose output */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) FILE *output; /* logfile */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) char *output_filename; /* logfile name, must be freed at the end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) if output != NULL and output != stdout*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) enum sched_prio string_to_prio(const char *str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) FILE *prepare_output(const char *dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) int prepare_config(const char *path, struct config *config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct config *prepare_default_config();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)