pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/sysutils/estd
Module Name: pkgsrc
Committed By: mrg
Date: Fri Jun 23 23:25:52 UTC 2023
Modified Files:
pkgsrc/sysutils/estd: Makefile distinfo
pkgsrc/sysutils/estd/patches: patch-estd.1 patch-estd.c
Log Message:
add support for SIGUSR1/SIGUSR2 to adjust frequency instead of strategy.
new -x means USR1 reduces the minimum and USR2 increases the minimum,
and new -X adjusts the maximum similarly.
-X is designed to allow the user to force the CPU into a lower speed
frequency, without having to restart estd entirely. -x was added for
symmetry.
To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 pkgsrc/sysutils/estd/Makefile
cvs rdiff -u -r1.26 -r1.27 pkgsrc/sysutils/estd/distinfo
cvs rdiff -u -r1.1 -r1.2 pkgsrc/sysutils/estd/patches/patch-estd.1
cvs rdiff -u -r1.2 -r1.3 pkgsrc/sysutils/estd/patches/patch-estd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/sysutils/estd/Makefile
diff -u pkgsrc/sysutils/estd/Makefile:1.38 pkgsrc/sysutils/estd/Makefile:1.39
--- pkgsrc/sysutils/estd/Makefile:1.38 Sun Apr 25 07:51:25 2021
+++ pkgsrc/sysutils/estd/Makefile Fri Jun 23 23:25:52 2023
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.38 2021/04/25 07:51:25 mrg Exp $
+# $NetBSD: Makefile,v 1.39 2023/06/23 23:25:52 mrg Exp $
DISTNAME= estd-r11
PKGNAME= estd-0.11
-PKGREVISION= 3
+PKGREVISION= 4
CATEGORIES= sysutils
MASTER_SITES= http://flpsed.org/
Index: pkgsrc/sysutils/estd/distinfo
diff -u pkgsrc/sysutils/estd/distinfo:1.26 pkgsrc/sysutils/estd/distinfo:1.27
--- pkgsrc/sysutils/estd/distinfo:1.26 Tue Oct 26 11:19:33 2021
+++ pkgsrc/sysutils/estd/distinfo Fri Jun 23 23:25:52 2023
@@ -1,8 +1,8 @@
-$NetBSD: distinfo,v 1.26 2021/10/26 11:19:33 nia Exp $
+$NetBSD: distinfo,v 1.27 2023/06/23 23:25:52 mrg Exp $
BLAKE2s (estd-r11.tar.gz) = 7da35ee29b4c69dd9b2a8b240996a2bed2f28f1108714ca1bf4fdb71f2268cca
SHA512 (estd-r11.tar.gz) = 37b005ab451f7a26248064cee5736ca43c6345b419e00050186158d5830fe96035fa78d2651a908899e6c61d44b1aaeb8b3cac0fbde19fb4c82976f709b011dc
Size (estd-r11.tar.gz) = 9361 bytes
SHA1 (patch-aa) = 6671d042e8b593b33e8633d657b14acaf3f115eb
-SHA1 (patch-estd.1) = 9e58f33fc722681728306c92678e1cfe6d5b373e
-SHA1 (patch-estd.c) = 1cfdf7b8f90152c1b420ada3f22c297f1256f98e
+SHA1 (patch-estd.1) = e1c17a02cdeeba9635057d2c2a132d438635cf04
+SHA1 (patch-estd.c) = 42f1152031a4241e34beb03061c26ffbaa34e5a6
Index: pkgsrc/sysutils/estd/patches/patch-estd.1
diff -u pkgsrc/sysutils/estd/patches/patch-estd.1:1.1 pkgsrc/sysutils/estd/patches/patch-estd.1:1.2
--- pkgsrc/sysutils/estd/patches/patch-estd.1:1.1 Sun Oct 6 11:35:16 2019
+++ pkgsrc/sysutils/estd/patches/patch-estd.1 Fri Jun 23 23:25:52 2023
@@ -1,22 +1,23 @@
-$NetBSD: patch-estd.1,v 1.1 2019/10/06 11:35:16 jmcneill Exp $
+$NetBSD: patch-estd.1,v 1.2 2023/06/23 23:25:52 mrg Exp $
Document Generic Multi-domain Mode.
+Document -x/-X.
---- estd.1.orig 2015-02-18 21:38:03.000000000 +0000
-+++ estd.1
+--- estd.1.orig 2015-02-18 13:38:03.000000000 -0800
++++ estd.1 2023-06-23 16:17:50.117530062 -0700
@@ -1,9 +1,9 @@
-.TH estd 1 "February 18, 2015" "release 11" "USER COMMANDS"
-+.TH estd 1 "October 6, 2019" "release 11" "USER COMMANDS"
++.TH estd 1 "June 23, 2023" "release 11" "USER COMMANDS"
.SH NAME
estd \- Enhanced SpeedStep & PowerNow management daemon
.SH SYNOPSIS
.B estd
-[\-d] [\-o] [\-A] [\-C] [\-E] [\-I] [\-L] [\-R] [\-P] [\-G] [\-a] [\-s] [\-b] [\-p interval] [\-g period] [\-l low] [\-h high] [\-m minimum] [\-M maximum]
-+[\-d] [\-o] [\-A] [\-C] [\-D] [\-E] [\-I] [\-L] [\-R] [\-P] [\-G] [\-a] [\-s] [\-b] [\-p interval] [\-g period] [\-l low] [\-h high] [\-m minimum] [\-M maximum]
++[\-d] [\-o] [\-A] [\-C] [\-D] [\-E] [\-I] [\-L] [\-R] [\-P] [\-G] [\-a] [\-s] [\-b] [\-x] [\-X] [\-p interval] [\-g period] [\-l low] [\-h high] [\-m minimum] [\-M maximum]
.PP
.B estd
-f
-@@ -51,6 +51,9 @@ clock modulation feature will be turned
+@@ -51,6 +51,9 @@
speed mode is chosen by estd, in which case the lowest clock duty cycle
is used (this feature is not available on Dragonfly BSD)
.TP
@@ -26,3 +27,18 @@ Document Generic Multi-domain Mode.
\-E
Force Enhanced Speedstep-Mode.
.TP
+@@ -83,6 +86,14 @@
+ Select frequency-switching strategy: battery. This tries to optimize for
+ maximum battery lifetime
+ .TP
++\-x
++Convert SIGUSR1 and SIGUSR2 to adjust the minimum frequency, the same as
++using the -m option.
++.TP
++\-X
++Convert SIGUSR1 and SIGUSR2 to adjust the maximum frequency, the same as
++using the -M option.
++.TP
+ \-p interval
+ Poll Interval between CPU-updates in microseconds. Lower values will adapt
+ smoothly to your workload, but increase overhead. (default 500000 = 0.5s)
Index: pkgsrc/sysutils/estd/patches/patch-estd.c
diff -u pkgsrc/sysutils/estd/patches/patch-estd.c:1.2 pkgsrc/sysutils/estd/patches/patch-estd.c:1.3
--- pkgsrc/sysutils/estd/patches/patch-estd.c:1.2 Sun Oct 6 11:35:16 2019
+++ pkgsrc/sysutils/estd/patches/patch-estd.c Fri Jun 23 23:25:52 2023
@@ -1,10 +1,12 @@
-$NetBSD: patch-estd.c,v 1.2 2019/10/06 11:35:16 jmcneill Exp $
+$NetBSD: patch-estd.c,v 1.3 2023/06/23 23:25:52 mrg Exp $
- Removed useless "estd: Forked" message
- Add support for generic multi-domain frequency controls
+- Add support for -x/-X options: SIGUSR* adjust min or max speed.
+ Will adjust all frequency domains max or min, up or down.
---- estd.c.orig 2015-02-18 21:38:03.000000000 +0000
-+++ estd.c
+--- estd.c.orig 2015-02-18 13:38:03.000000000 -0800
++++ estd.c 2023-06-22 02:47:03.614057986 -0700
@@ -58,8 +58,9 @@
#define TECH_INTREPID 4
#define TECH_LOONGSON 5
@@ -17,7 +19,16 @@ $NetBSD: patch-estd.c,v 1.2 2019/10/06 1
/* this is ugly, but... <shrug> */
#define MAX_FREQS 32
-@@ -128,6 +129,7 @@ static char *techdesc[TECH_MAX + 1] = {"
+@@ -108,6 +109,8 @@
+ int ncpus = 0;
+ struct domain *domain;
+ int ndomains;
++char minmax_mode;
++sig_atomic_t got_sigminmax;
+
+ #if defined(__DragonFly__)
+ static struct kinfo_cputime *cp_time;
+@@ -128,6 +131,7 @@
"Intrepid",
"Loongson",
"Rockchip",
@@ -25,7 +36,7 @@ $NetBSD: patch-estd.c,v 1.2 2019/10/06 1
"Generic"
};
static char *freqctl[TECH_MAX + 1] = { "",
-@@ -137,6 +139,7 @@ static char *freqctl[TECH_MAX + 1] = { "
+@@ -137,6 +141,7 @@
"machdep.intrepid.frequency.available",
"machdep.loongson.frequency.available",
"machdep.cpu.frequency.available",
@@ -33,7 +44,7 @@ $NetBSD: patch-estd.c,v 1.2 2019/10/06 1
"machdep.frequency.available"
};
static char *setctl[TECH_MAX + 1] = { "",
-@@ -146,6 +149,7 @@ static char *setctl[TECH_MAX + 1] = { ""
+@@ -146,6 +151,7 @@
"machdep.intrepid.frequency.target",
"machdep.loongson.frequency.target",
"machdep.cpu.frequency.target",
@@ -41,7 +52,7 @@ $NetBSD: patch-estd.c,v 1.2 2019/10/06 1
"machdep.frequency.current"
};
-@@ -234,6 +238,63 @@ acpi_init()
+@@ -234,6 +240,63 @@
}
@@ -105,7 +116,7 @@ $NetBSD: patch-estd.c,v 1.2 2019/10/06 1
/* returns cpu-usage in percent, mean over the sleep-interval or -1 if an error occured */
#if defined(__DragonFly__)
int
-@@ -308,8 +369,10 @@ get_cpuusage(int d)
+@@ -308,8 +371,10 @@
int cpu_of_max = 0;
int cpu;
int i;
@@ -117,7 +128,93 @@ $NetBSD: patch-estd.c,v 1.2 2019/10/06 1
u_int64_t total_time = 0;
for (i = 0; i < CPUSTATES; i++) {
-@@ -401,7 +464,7 @@ main(int argc, char *argv[])
+@@ -384,13 +449,80 @@
+ void
+ sigusrhandler(int sig)
+ {
+- switch (sig) {
++ if (minmax_mode) {
++ got_sigminmax = sig;
++ } else {
++ switch (sig) {
+ case SIGUSR1:
+- if (strategy>BATTERY) strategy--;
+- break;
++ if (strategy>BATTERY) strategy--;
++ break;
+ case SIGUSR2:
+- if (strategy<AGGRESSIVE) strategy++;
+- break;
++ if (strategy<AGGRESSIVE) strategy++;
++ break;
++ }
++ }
++}
++
++static void handle_sigminmax(int sig)
++{
++ int d, idx;
++
++ /* SIGUSR1 to reduce, SIGUSR2 to increase */
++ for (d = 0; d < ndomains; d++) {
++ if (minmax_mode == 'X' && sig == SIGUSR1) {
++ if (domain[d].maxidx == 0)
++ return;
++ domain[d].maxidx--;
++ if (verbose)
++ printf("SIGUSR1, reducing maxfreq to %d Mhz\n", domain[d].freqtab[domain[d].maxidx]);
++ if (domain[d].maxidx < domain[d].curfreq) {
++ domain[d].curfreq--;
++ set_freq(d);
++ set_clockmod(clockmod_min);
++ if (verbose)
++ printf("SIGUSR1, also set curfreq to %d Mhz\n", domain[d].freqtab[domain[d].maxidx]);
++ }
++ return;
++ }
++ if (minmax_mode == 'X' && sig == SIGUSR2) {
++ if (domain[d].maxidx + 1 == domain[d].nfreqs)
++ return;
++ domain[d].maxidx++;
++ /*
++ * Nothing to worry about here; if we need to increase the
++ * frequency due to load, the current iteration will.
++ */
++ if (verbose)
++ printf("SIGUSR1, increased maxfreq to %d Mhz\n", domain[d].freqtab[domain[d].maxidx]);
++ return;
++ }
++ if (minmax_mode == 'x' && sig == SIGUSR1) {
++ if (domain[d].minidx == 0)
++ return;
++ domain[d].minidx--;
++ /*
++ * Nothing to worry about here; if we need to increase the
++ * frequency due to load, the current iteration will.
++ */
++ if (verbose)
++ printf("SIGUSR1, reducing minfreq to %d Mhz\n", domain[d].freqtab[domain[d].minidx]);
++ return;
++ }
++ if (minmax_mode == 'x' && sig == SIGUSR2) {
++ if (domain[d].minidx + 1 == domain[d].nfreqs)
++ return;
++ domain[d].minidx++;
++ if (verbose)
++ printf("SIGUSR1, increased minfreq to %d Mhz\n", domain[d].freqtab[domain[d].minidx]);
++ if (domain[d].minidx < domain[d].curfreq) {
++ domain[d].curfreq--;
++ set_freq(d);
++ set_clockmod(clockmod_min);
++ if (verbose)
++ printf("SIGUSR1, also set curfreq to %d Mhz\n", domain[d].freqtab[domain[d].minidx]);
++ }
++ return;
++ }
+ }
+ }
+
+@@ -401,7 +533,7 @@
int i;
char frequencies[SYSCTLBUF]; /* XXX Ugly */
char *fp;
@@ -126,16 +223,16 @@ $NetBSD: patch-estd.c,v 1.2 2019/10/06 1
int curstrat = strategy;
int d;
FILE *fexists;
-@@ -410,7 +473,7 @@ main(int argc, char *argv[])
+@@ -410,7 +542,7 @@
#endif
/* get command-line options */
- while ((ch = getopt(argc, argv, "vfdonACEGILPasbp:h:l:g:m:M:")) != -1)
-+ while ((ch = getopt(argc, argv, "vfdonACDEGILPasbp:h:l:g:m:M:")) != -1)
++ while ((ch = getopt(argc, argv, "vfdonACDEGILPasbp:h:l:g:m:M:xX")) != -1)
switch (ch) {
case 'v':
version();
-@@ -438,6 +501,9 @@ main(int argc, char *argv[])
+@@ -438,6 +570,9 @@
fprintf(stderr, "-C not available under DragonFly\n");
exit(1);
#endif
@@ -145,7 +242,20 @@ $NetBSD: patch-estd.c,v 1.2 2019/10/06 1
case 'E':
tech = TECH_EST;
break;
-@@ -516,6 +582,7 @@ main(int argc, char *argv[])
+@@ -483,6 +618,12 @@
+ case 'M':
+ maxmhz = atoi(optarg);
+ break;
++ case 'x':
++ minmax_mode = 'x';
++ break;
++ case 'X':
++ minmax_mode = 'X';
++ break;
+ default:
+ usage();
+ /* NOTREACHED */
+@@ -516,6 +657,7 @@
/* try to guess cpu-scaling technology */
if (tech == TECH_UNKNOWN) {
for (tech = 1; tech <= TECH_MAX; tech++) {
@@ -153,7 +263,7 @@ $NetBSD: patch-estd.c,v 1.2 2019/10/06 1
if (sysctlbyname(freqctl[tech], &frequencies, &freqsize, NULL, 0) >= 0) break;
}
if (tech > TECH_MAX) {
-@@ -529,6 +596,11 @@ main(int argc, char *argv[])
+@@ -529,6 +671,11 @@
fprintf(stderr, "estd: Cannot ACPI P-States\n");
exit(1);
}
@@ -165,7 +275,7 @@ $NetBSD: patch-estd.c,v 1.2 2019/10/06 1
} else {
domain[0].freqctl = freqctl[tech];
domain[0].setctl = setctl[tech];
-@@ -552,6 +624,7 @@ main(int argc, char *argv[])
+@@ -552,6 +699,7 @@
/* for each cpu domain... */
for (d = 0; d < ndomains; d++) {
/* get supported frequencies... */
@@ -173,7 +283,7 @@ $NetBSD: patch-estd.c,v 1.2 2019/10/06 1
if (sysctlbyname(domain[d].freqctl, &frequencies, &freqsize, NULL, 0) < 0) {
fprintf(stderr, "estd: Cannot get supported frequencies (maybe you forced the wrong CPU-scaling technology?)\n");
exit(1);
-@@ -588,7 +661,11 @@ main(int argc, char *argv[])
+@@ -588,7 +736,11 @@
if (listfreq) {
printf("Supported frequencies (%s Mode):\n",techdesc[tech]);
for (d = 0; d < ndomains; d++) {
@@ -186,7 +296,7 @@ $NetBSD: patch-estd.c,v 1.2 2019/10/06 1
for (i = 0; i < domain[d].nfreqs; i++) {
printf("%i MHz\n", domain[d].freqtab[i]);
}
-@@ -626,7 +703,6 @@ main(int argc, char *argv[])
+@@ -626,7 +778,6 @@
/* all ok, here we go */
if (daemonize) {
if (fork()) {
@@ -194,3 +304,16 @@ $NetBSD: patch-estd.c,v 1.2 2019/10/06 1
exit(0);
}
} else {
+@@ -664,6 +815,12 @@
+
+ /* the big processing loop, we will only exit via signal */
+ while (1) {
++ if (got_sigminmax) {
++ int sig = got_sigminmax;
++
++ got_sigminmax = 0;
++ handle_sigminmax(sig);
++ }
+ get_cputime();
+ for (d = 0; d < ndomains; d++) {
+ domain[d].curcpu = get_cpuusage(d);
Home |
Main Index |
Thread Index |
Old Index