automatically detect threads and prompt user for polling time at build time

This commit is contained in:
celso 2022-11-22 18:32:12 -03:00
parent ed9a20cbe3
commit b24cc115fa
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,8 @@
CC = gcc CC = gcc
CFLAGS = -Wall -Wpedantic -Wextra -O2 -march=native CFLAGS = -Wall -Wpedantic -Wextra -O2 -march=native\
-DTHREADS=$(shell grep processor /proc/cpuinfo | wc -l)\
-DPOLLING_TIME=$(shell read -p "type seconds between temp checks >" P;\
echo $$P)
SRC = src SRC = src
BINDIR = bin BINDIR = bin
BIN = homemade_speedstep BIN = homemade_speedstep

View File

@ -3,8 +3,6 @@
#include <unistd.h> #include <unistd.h>
#define VERSION "1.1" #define VERSION "1.1"
#define POLLING_TIME 1
#define THREADS 4 /* TODO: automatically figure out how many threads host system has */
#define FREQS "/sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies" #define FREQS "/sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies"
#define MAXSPDPREFIX "/sys/devices/system/cpu/cpu" #define MAXSPDPREFIX "/sys/devices/system/cpu/cpu"
#define MAXSPDSUFFIX "/cpufreq/scaling_max_freq" #define MAXSPDSUFFIX "/cpufreq/scaling_max_freq"