mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-06-06 15:47:20 +02:00
fixed more coding style errors
This commit is contained in:
parent
912d4bdc19
commit
81dc3f95e5
@ -35,8 +35,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <sched.h>
|
||||
#include <linux/limits.h>
|
||||
|
||||
#include "common-external.h"
|
||||
#include "common-cpu.h"
|
||||
#include "common-external.h"
|
||||
#include "common-helpers.h"
|
||||
#include "common-logging.h"
|
||||
|
||||
@ -86,7 +86,8 @@ static int walk_sysfs(char *cpulist, char **buf, size_t *buflen, GameModeCPUInfo
|
||||
CPU_SET_S((size_t)cpu, CPU_ALLOC_SIZE(info->num_cpu), info->online);
|
||||
|
||||
/* check for L3 cache non-uniformity among the cores */
|
||||
int ret = snprintf(path, PATH_MAX, "/sys/devices/system/cpu/cpu%ld/cache/index3/size", cpu);
|
||||
int ret =
|
||||
snprintf(path, PATH_MAX, "/sys/devices/system/cpu/cpu%ld/cache/index3/size", cpu);
|
||||
|
||||
if (ret > 0 && ret < PATH_MAX) {
|
||||
if (read_small_file(path, buf, buflen)) {
|
||||
@ -115,7 +116,10 @@ static int walk_sysfs(char *cpulist, char **buf, size_t *buflen, GameModeCPUInfo
|
||||
}
|
||||
|
||||
/* check for frequency non-uniformity among the cores */
|
||||
ret = snprintf(path, PATH_MAX, "/sys/devices/system/cpu/cpu%ld/cpufreq/cpuinfo_max_freq", cpu);
|
||||
ret = snprintf(path,
|
||||
PATH_MAX,
|
||||
"/sys/devices/system/cpu/cpu%ld/cpufreq/cpuinfo_max_freq",
|
||||
cpu);
|
||||
|
||||
if (ret > 0 && ret < PATH_MAX) {
|
||||
if (read_small_file(path, buf, buflen)) {
|
||||
@ -136,13 +140,15 @@ static int walk_sysfs(char *cpulist, char **buf, size_t *buflen, GameModeCPUInfo
|
||||
}
|
||||
}
|
||||
|
||||
if (CPU_EQUAL_S(CPU_ALLOC_SIZE(info->num_cpu), info->online, info->to_keep) || CPU_COUNT_S(CPU_ALLOC_SIZE(info->num_cpu), info->to_keep) == 0) {
|
||||
if (CPU_EQUAL_S(CPU_ALLOC_SIZE(info->num_cpu), info->online, info->to_keep) ||
|
||||
CPU_COUNT_S(CPU_ALLOC_SIZE(info->num_cpu), info->to_keep) == 0) {
|
||||
LOG_MSG("cpu L3 cache was uniform, this is not a x3D with multiple chiplets\n");
|
||||
|
||||
CPU_FREE(info->to_keep);
|
||||
info->to_keep = freq_cores;
|
||||
|
||||
if (CPU_EQUAL_S(CPU_ALLOC_SIZE(info->num_cpu), info->online, info->to_keep) || CPU_COUNT_S(CPU_ALLOC_SIZE(info->num_cpu), info->to_keep) == 0)
|
||||
if (CPU_EQUAL_S(CPU_ALLOC_SIZE(info->num_cpu), info->online, info->to_keep) ||
|
||||
CPU_COUNT_S(CPU_ALLOC_SIZE(info->num_cpu), info->to_keep) == 0)
|
||||
LOG_MSG("cpu frequency was uniform, this is not a big.LITTLE type of system\n");
|
||||
} else {
|
||||
CPU_FREE(freq_cores);
|
||||
@ -195,9 +201,11 @@ int game_mode_initialise_cpu(GameModeConfig *config, GameModeCPUInfo **info)
|
||||
int park_or_pin = -1;
|
||||
|
||||
if (pin_cores[0] != '\0') {
|
||||
if (strcasecmp(pin_cores, "no") == 0 || strcasecmp(pin_cores, "false") == 0 || strcmp(pin_cores, "0") == 0) {
|
||||
if (strcasecmp(pin_cores, "no") == 0 || strcasecmp(pin_cores, "false") == 0 ||
|
||||
strcmp(pin_cores, "0") == 0) {
|
||||
park_or_pin = -2;
|
||||
} else if (strcasecmp(pin_cores, "yes") == 0 || strcasecmp(pin_cores, "true") == 0 || strcmp(pin_cores, "1") == 0) {
|
||||
} else if (strcasecmp(pin_cores, "yes") == 0 || strcasecmp(pin_cores, "true") == 0 ||
|
||||
strcmp(pin_cores, "1") == 0) {
|
||||
pin_cores[0] = '\0';
|
||||
park_or_pin = 1;
|
||||
} else {
|
||||
@ -206,12 +214,14 @@ int game_mode_initialise_cpu(GameModeConfig *config, GameModeCPUInfo **info)
|
||||
}
|
||||
|
||||
if (park_or_pin < 1 && park_cores[0] != '\0') {
|
||||
if (strcasecmp(park_cores, "no") == 0 || strcasecmp(park_cores, "false") == 0 || strcmp(park_cores, "0") == 0) {
|
||||
if (strcasecmp(park_cores, "no") == 0 || strcasecmp(park_cores, "false") == 0 ||
|
||||
strcmp(park_cores, "0") == 0) {
|
||||
if (park_or_pin == -2)
|
||||
return 0;
|
||||
|
||||
park_or_pin = -1;
|
||||
} else if (strcasecmp(park_cores, "yes") == 0 || strcasecmp(park_cores, "true") == 0 || strcmp(park_cores, "1") == 0) {
|
||||
} else if (strcasecmp(park_cores, "yes") == 0 || strcasecmp(park_cores, "true") == 0 ||
|
||||
strcmp(park_cores, "1") == 0) {
|
||||
park_cores[0] = '\0';
|
||||
park_or_pin = 0;
|
||||
} else {
|
||||
@ -264,7 +274,8 @@ int game_mode_initialise_cpu(GameModeConfig *config, GameModeCPUInfo **info)
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
if (park_or_pin == 0 && CPU_EQUAL_S(CPU_ALLOC_SIZE(new_info->num_cpu), new_info->online, new_info->to_keep)) {
|
||||
if (park_or_pin == 0 &&
|
||||
CPU_EQUAL_S(CPU_ALLOC_SIZE(new_info->num_cpu), new_info->online, new_info->to_keep)) {
|
||||
game_mode_free_cpu(&new_info);
|
||||
LOG_MSG("I can find no reason to perform core parking on this system!\n");
|
||||
goto error_exit;
|
||||
@ -272,7 +283,9 @@ int game_mode_initialise_cpu(GameModeConfig *config, GameModeCPUInfo **info)
|
||||
|
||||
if (CPU_COUNT_S(CPU_ALLOC_SIZE(new_info->num_cpu), new_info->to_keep) < 4) {
|
||||
game_mode_free_cpu(&new_info);
|
||||
LOG_MSG("logic or config would result in less than 4 active cores, will not apply cpu core parking/pinning!\n");
|
||||
LOG_MSG(
|
||||
"logic or config would result in less than 4 active cores, will not apply cpu core "
|
||||
"parking/pinning!\n");
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
@ -328,7 +341,8 @@ int game_mode_park_cpu(const GameModeCPUInfo *info)
|
||||
int pos = 0;
|
||||
|
||||
for (long cpu = 0; cpu < (long)(info->num_cpu); cpu++) {
|
||||
if (CPU_ISSET_S((size_t)cpu, CPU_ALLOC_SIZE(info->num_cpu), info->online) && !CPU_ISSET_S((size_t)cpu, CPU_ALLOC_SIZE(info->num_cpu), info->to_keep)) {
|
||||
if (CPU_ISSET_S((size_t)cpu, CPU_ALLOC_SIZE(info->num_cpu), info->online) &&
|
||||
!CPU_ISSET_S((size_t)cpu, CPU_ALLOC_SIZE(info->num_cpu), info->to_keep)) {
|
||||
if (first == -1) {
|
||||
first = cpu;
|
||||
last = cpu;
|
||||
@ -372,7 +386,8 @@ int game_mode_unpark_cpu(const GameModeCPUInfo *info)
|
||||
int pos = 0;
|
||||
|
||||
for (long cpu = 0; cpu < (long)(info->num_cpu); cpu++) {
|
||||
if (CPU_ISSET_S((size_t)cpu, CPU_ALLOC_SIZE(info->num_cpu), info->online) && !CPU_ISSET_S((size_t)cpu, CPU_ALLOC_SIZE(info->num_cpu), info->to_keep)) {
|
||||
if (CPU_ISSET_S((size_t)cpu, CPU_ALLOC_SIZE(info->num_cpu), info->online) &&
|
||||
!CPU_ISSET_S((size_t)cpu, CPU_ALLOC_SIZE(info->num_cpu), info->to_keep)) {
|
||||
if (first == -1) {
|
||||
first = cpu;
|
||||
last = cpu;
|
||||
|
Loading…
x
Reference in New Issue
Block a user