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:   jmcneill
Date:           Sun Oct  6 11:35:16 UTC 2019

Modified Files:
        pkgsrc/sysutils/estd: Makefile distinfo
        pkgsrc/sysutils/estd/patches: patch-estd.c
Added Files:
        pkgsrc/sysutils/estd/patches: patch-estd.1

Log Message:
Add "Generic Multi-domain Mode" support and track CPU usage on a per-domain
basis when enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 pkgsrc/sysutils/estd/Makefile
cvs rdiff -u -r1.23 -r1.24 pkgsrc/sysutils/estd/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/estd/patches/patch-estd.1
cvs rdiff -u -r1.1 -r1.2 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.35 pkgsrc/sysutils/estd/Makefile:1.36
--- pkgsrc/sysutils/estd/Makefile:1.35  Wed Aug 14 21:36:09 2019
+++ pkgsrc/sysutils/estd/Makefile       Sun Oct  6 11:35:16 2019
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.35 2019/08/14 21:36:09 macallan Exp $
+# $NetBSD: Makefile,v 1.36 2019/10/06 11:35:16 jmcneill Exp $
 
 DISTNAME=      estd-r11
 PKGNAME=       estd-0.11
-PKGREVISION=   2
+PKGREVISION=   3
 CATEGORIES=    sysutils
 MASTER_SITES=  http://flpsed.org/
 

Index: pkgsrc/sysutils/estd/distinfo
diff -u pkgsrc/sysutils/estd/distinfo:1.23 pkgsrc/sysutils/estd/distinfo:1.24
--- pkgsrc/sysutils/estd/distinfo:1.23  Wed Oct 25 21:38:52 2017
+++ pkgsrc/sysutils/estd/distinfo       Sun Oct  6 11:35:16 2019
@@ -1,8 +1,9 @@
-$NetBSD: distinfo,v 1.23 2017/10/25 21:38:52 khorben Exp $
+$NetBSD: distinfo,v 1.24 2019/10/06 11:35:16 jmcneill Exp $
 
 SHA1 (estd-r11.tar.gz) = 6c1148d66ff93b2e45af0411f1234fcccd1a2407
 RMD160 (estd-r11.tar.gz) = 261a6a79e54f2502a50aad79e336259604376f3c
 SHA512 (estd-r11.tar.gz) = 37b005ab451f7a26248064cee5736ca43c6345b419e00050186158d5830fe96035fa78d2651a908899e6c61d44b1aaeb8b3cac0fbde19fb4c82976f709b011dc
 Size (estd-r11.tar.gz) = 9361 bytes
 SHA1 (patch-aa) = 6671d042e8b593b33e8633d657b14acaf3f115eb
-SHA1 (patch-estd.c) = e813e795a18fa16ced0070fe7485dff3f3de61ac
+SHA1 (patch-estd.1) = 9e58f33fc722681728306c92678e1cfe6d5b373e
+SHA1 (patch-estd.c) = 1cfdf7b8f90152c1b420ada3f22c297f1256f98e

Index: pkgsrc/sysutils/estd/patches/patch-estd.c
diff -u pkgsrc/sysutils/estd/patches/patch-estd.c:1.1 pkgsrc/sysutils/estd/patches/patch-estd.c:1.2
--- pkgsrc/sysutils/estd/patches/patch-estd.c:1.1       Fri Mar  6 18:08:38 2015
+++ pkgsrc/sysutils/estd/patches/patch-estd.c   Sun Oct  6 11:35:16 2019
@@ -1,10 +1,192 @@
-$NetBSD: patch-estd.c,v 1.1 2015/03/06 18:08:38 khorben Exp $
+$NetBSD: patch-estd.c,v 1.2 2019/10/06 11:35:16 jmcneill Exp $
 
-Removed useless "estd: Forked" message
+- Removed useless "estd: Forked" message
+- Add support for generic multi-domain frequency controls
 
 --- estd.c.orig        2015-02-18 21:38:03.000000000 +0000
 +++ estd.c
-@@ -626,7 +626,6 @@ main(int argc, char *argv[])
+@@ -58,8 +58,9 @@
+ #define TECH_INTREPID 4
+ #define TECH_LOONGSON 5
+ #define TECH_ROCKCHIP 6
+-#define TECH_GENERIC 7
+-#define TECH_MAX 7
++#define TECH_GENERIC_MD 7
++#define TECH_GENERIC 8
++#define TECH_MAX 8
+  
+ /* this is ugly, but... <shrug> */
+ #define MAX_FREQS 32
+@@ -128,6 +129,7 @@ static char        *techdesc[TECH_MAX + 1] = {"
+                               "Intrepid",
+                               "Loongson",
+                               "Rockchip",
++                              "Generic Multi-domain",
+                               "Generic"
+                               };
+ static char   *freqctl[TECH_MAX + 1] = {      "",     
+@@ -137,6 +139,7 @@ static char        *freqctl[TECH_MAX + 1] = {      "
+                               "machdep.intrepid.frequency.available",
+                               "machdep.loongson.frequency.available",
+                               "machdep.cpu.frequency.available",
++                              "machdep.cpufreq.cpu0.available",
+                               "machdep.frequency.available"
+                               };
+ static char   *setctl[TECH_MAX + 1] = {       "",
+@@ -146,6 +149,7 @@ static char        *setctl[TECH_MAX + 1] = {       ""
+                               "machdep.intrepid.frequency.target",
+                               "machdep.loongson.frequency.target",
+                               "machdep.cpu.frequency.target",
++                              "machdep.cpufreq.cpu0.target",
+                               "machdep.frequency.current"
+                               };
+ 
+@@ -234,6 +238,63 @@ acpi_init()
+ }
+ 
+ 
++int
++generic_md_init_cpu(int d, int cpu)
++{
++      char name[256];
++      char current[SYSCTLBUF];
++      char *mp;
++      size_t currentsize = SYSCTLBUF;
++      int i;
++
++      snprintf(name, sizeof(name), "machdep.cpufreq.cpu%d.current", cpu);
++      if (sysctlbyname(name, &current, &currentsize, NULL, 0) < 0) {
++              if (d > 0) {
++                      /* Assume this CPU is a member of the previous domain */
++                      domain[d-1].cpus[domain[d-1].ncpus++] = cpu;
++              }
++              return 1;
++      }
++
++      ndomains = d + 1;
++      domain = realloc(domain, ndomains * sizeof(struct domain));
++      if (domain == NULL) {
++              fprintf(stderr, "estd: realloc failed (errno %d)\n", errno);
++              exit(1);
++      }
++      memset(&domain[d], 0, sizeof(struct domain));
++
++      domain[d].ncpus = 1;
++      domain[d].cpus = ecalloc(ncpus, sizeof(int));
++      domain[d].cpus[0] = cpu;
++
++      asprintf(&domain[d].freqctl, "machdep.cpufreq.cpu%d.available", cpu);
++      asprintf(&domain[d].setctl, "machdep.cpufreq.cpu%d.target", cpu);
++      if (domain[d].setctl == NULL || domain[d].freqctl == NULL) {
++              fprintf(stderr, "estd: asprintf failed\n");
++              exit(1);
++      }
++
++      if ((!daemonize) && (verbose))
++              for (i = 0; i < domain[d].ncpus; i++)
++                      printf("estd: domain %d: member %d\n", d, domain[d].cpus[i]);
++
++      return 0;
++}
++
++int
++generic_md_init()
++{
++      int d = 0, cpu;
++
++      for (cpu = 0; cpu < ncpus; cpu++)
++              if (generic_md_init_cpu(d, cpu) == 0)
++                      d++;
++
++      return d > 0 ? 0 : 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)
+       int             cpu_of_max = 0;
+       int             cpu;
+       int             i;
++      int             n;
+ 
+-      for (cpu = 0; cpu < ncpus; cpu++) {
++      for (n = 0; n < domain[d].ncpus; n++) {
++              cpu = domain[d].cpus[n];
+               u_int64_t total_time = 0;
+ 
+               for (i = 0; i < CPUSTATES; i++) {
+@@ -401,7 +464,7 @@ main(int argc, char *argv[])
+       int             i;
+       char            frequencies[SYSCTLBUF]; /* XXX Ugly */
+       char           *fp;
+-      size_t          freqsize = SYSCTLBUF;
++      size_t          freqsize;
+       int                 curstrat = strategy;
+       int             d;
+       FILE           *fexists;
+@@ -410,7 +473,7 @@ main(int argc, char *argv[])
+ #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)
+               switch (ch) {
+               case 'v':
+                       version();
+@@ -438,6 +501,9 @@ main(int argc, char *argv[])
+                        fprintf(stderr, "-C not available under DragonFly\n");
+                        exit(1);
+                       #endif
++              case 'D':
++                      tech = TECH_GENERIC_MD;
++                      break;
+               case 'E':
+                       tech = TECH_EST;
+                       break;
+@@ -516,6 +582,7 @@ main(int argc, char *argv[])
+       /* try to guess cpu-scaling technology */
+       if (tech == TECH_UNKNOWN) {
+               for (tech = 1; tech <= TECH_MAX; tech++) {
++                      freqsize = SYSCTLBUF;
+                       if (sysctlbyname(freqctl[tech], &frequencies, &freqsize, NULL, 0) >= 0) break;
+               }
+               if (tech > TECH_MAX) {
+@@ -529,6 +596,11 @@ main(int argc, char *argv[])
+                       fprintf(stderr, "estd: Cannot ACPI P-States\n");
+                       exit(1);
+               }
++      } else if (tech == TECH_GENERIC_MD) {
++              if (generic_md_init()) {
++                      fprintf(stderr, "estd: Cannot init generic multi-domain support\n");
++                      exit(1);
++              }
+       } else {
+               domain[0].freqctl = freqctl[tech];
+               domain[0].setctl = setctl[tech];
+@@ -552,6 +624,7 @@ main(int argc, char *argv[])
+       /* for each cpu domain... */
+       for (d = 0; d < ndomains; d++) {
+               /* get supported frequencies... */
++              freqsize = SYSCTLBUF;
+               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[])
+       if (listfreq) {
+               printf("Supported frequencies (%s Mode):\n",techdesc[tech]);
+               for (d = 0; d < ndomains; d++) {
+-                      printf("Domain %d:\n", d);
++                      printf("Domain %d:", d);
++                      for (i = 0; i < domain[d].ncpus; i++) {
++                              printf(" cpu%d", domain[d].cpus[i]);
++                      }
++                      printf("\n");
+                       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[])
        /* all ok, here we go */
        if (daemonize) {
                if (fork()) {

Added files:

Index: pkgsrc/sysutils/estd/patches/patch-estd.1
diff -u /dev/null pkgsrc/sysutils/estd/patches/patch-estd.1:1.1
--- /dev/null   Sun Oct  6 11:35:16 2019
+++ pkgsrc/sysutils/estd/patches/patch-estd.1   Sun Oct  6 11:35:16 2019
@@ -0,0 +1,28 @@
+$NetBSD: patch-estd.1,v 1.1 2019/10/06 11:35:16 jmcneill Exp $
+
+Document Generic Multi-domain Mode.
+
+--- estd.1.orig        2015-02-18 21:38:03.000000000 +0000
++++ estd.1
+@@ -1,9 +1,9 @@
+-.TH estd 1 "February 18, 2015" "release 11" "USER COMMANDS"
++.TH estd 1 "October 6, 2019" "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]
+ .PP
+ .B estd
+ -f
+@@ -51,6 +51,9 @@ clock modulation feature will be turned 
+ 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
++\-D
++Force Generic Multi-domain Mode.
++.TP
+ \-E
+ Force Enhanced Speedstep-Mode.
+ .TP



Home | Main Index | Thread Index | Old Index