aboutsummaryrefslogtreecommitdiffstats
path: root/argparse.c
diff options
context:
space:
mode:
authorPA4WDH2024-08-24 16:07:11 +0200
committerPA4WDH2024-08-24 16:07:11 +0200
commit66aca8aa35bc0b07c754d9ad95c808e4d91f58f1 (patch)
tree8f051b5cc7660ff596c7ef80c69a9a485016b26c /argparse.c
parentAdd -k option to keep state on successul exit (diff)
downloadcputemp2maxfreq-66aca8aa35bc0b07c754d9ad95c808e4d91f58f1.tar.gz
cputemp2maxfreq-66aca8aa35bc0b07c754d9ad95c808e4d91f58f1.tar.bz2
cputemp2maxfreq-66aca8aa35bc0b07c754d9ad95c808e4d91f58f1.zip
Add multi-CPU support
Diffstat (limited to 'argparse.c')
-rw-r--r--argparse.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/argparse.c b/argparse.c
index e46eab7..19a6493 100644
--- a/argparse.c
+++ b/argparse.c
@@ -30,6 +30,10 @@ void printhelp()
" Default: Always set CPU to lowest frequency on exit\n"
"-p <time> Poll interval in seconds\n"
" Default: %d\n"
+ "-P <CPU ID> Physical CPU number (socket number) for multi-CPU systems. Given\n"
+ " a number it will only change the governor/frequency for the\n"
+ " given CPU, or the word \"all\" to change all CPU's\n"
+ " Default: all\n"
"-s <step> Step size in Khz when increasing/decreasing CPU speed\n"
" Default: %ld\n"
"-t <number> Temperature limit\n"
@@ -73,7 +77,7 @@ void argparse(int argc, char **argv)
memcpy(&userconfig,&config,sizeof(struct s_config));
// Parse options
- while((opt=getopt(argc,argv,"c:C:d:f:g:hi:kl:mp:s:t:u"))!=-1)
+ while((opt=getopt(argc,argv,"c:C:d:f:g:hi:kl:mp:P:s:t:u"))!=-1)
{
DEBUG1_ARGPARSE("Argument: %c Value: %s\n",opt,optarg);
switch(opt)
@@ -118,6 +122,14 @@ void argparse(int argc, char **argv)
case 'p':
userconfig.interval=strtoll(optarg,NULL,10);
break;
+ case 'P':
+ if (strcmp(optarg,"all")==0)
+ {
+ userconfig.cpu=-1;
+ } else {
+ userconfig.cpu=strtoll(optarg,NULL,10);
+ }
+ break;
case 's':
userconfig.freq_step=strtoll(optarg,NULL,10);
break;