rpms/cpuspeed/devel cpuspeed-1.5-Makefile.patch, NONE, 1.1 cpuspeed-1.5-no-affected_cpus-fallback.patch, NONE, 1.1 .cvsignore, 1.4, 1.5 cpuspeed.spec, 1.69, 1.70 sources, 1.3, 1.4 cpuspeed-1.2.1-make-gcc43-happy.patch, 1.1, NONE cpuspeed-1.2.1-make.patch, 1.1, NONE cpuspeed-1.2.1-multicore-support.patch, 1.1, NONE cpuspeed-1.2.1-no-affected_cpus-fallback.patch, 1.1, NONE

Jarod Wilson jwilson at fedoraproject.org
Wed Oct 8 22:58:13 UTC 2008


Author: jwilson

Update of /cvs/pkgs/rpms/cpuspeed/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv27305

Modified Files:
	.cvsignore cpuspeed.spec sources 
Added Files:
	cpuspeed-1.5-Makefile.patch 
	cpuspeed-1.5-no-affected_cpus-fallback.patch 
Removed Files:
	cpuspeed-1.2.1-make-gcc43-happy.patch 
	cpuspeed-1.2.1-make.patch 
	cpuspeed-1.2.1-multicore-support.patch 
	cpuspeed-1.2.1-no-affected_cpus-fallback.patch 
Log Message:
* Wed Oct 08 2008 Jarod Wilson <jarod at redhat.com> 1.5-1
- Update to v1.5 release


cpuspeed-1.5-Makefile.patch:

--- NEW FILE cpuspeed-1.5-Makefile.patch ---
--- cpuspeed-1.5/Makefile	2008-10-08 15:00:12.000000000 -0400
+++ cpuspeed-1.5/Makefile.rh	2008-10-08 18:54:03.000000000 -0400
@@ -1,5 +1,8 @@
-CC=gcc -Wall -fno-exceptions
+CC=gcc
+CFLAGS=-Wall -fno-exceptions
 COPTS=-Os
+LDFLAGS=
+SBINDIR=/usr/sbin
 
 TARGET=cpuspeed
 DEBUG_TARGET=cpuspeed-debug
@@ -9,16 +12,16 @@ debug: $(DEBUG_TARGET)
 fake: $(FAKE_TARGET)
 
 $(TARGET): cpuspeed.cc
-	$(CC) -c $(COPTS) cpuspeed.cc
-	$(CC) cpuspeed.o -o $(TARGET)
-	strip $(TARGET)
+	$(CC) $(CFLAGS) -c $(COPTS) cpuspeed.cc
+	$(CC) $(CFLAGS) $(LDFLAGS) cpuspeed.o -o $(TARGET)
 
 # Debug target
 $(DEBUG_TARGET): cpuspeed.cc
 	$(CC) -c -g -DDEBUG -o cpuspeed_debug.o cpuspeed.cc
 	$(CC) cpuspeed_debug.o -o $(DEBUG_TARGET)
 
-install: install_redhat
+install: $(TARGET)
+	install -m755 $(TARGET) $(DESTDIR)/$(SBINDIR)/
 
 install_redhat: $(TARGET)
 	cp -f $(TARGET) /sbin

cpuspeed-1.5-no-affected_cpus-fallback.patch:

--- NEW FILE cpuspeed-1.5-no-affected_cpus-fallback.patch ---
--- cpuspeed-1.2.1/cpuspeed.cc~	2008-09-26 17:16:19.000000000 -0400
+++ cpuspeed-1.2.1/cpuspeed.cc	2008-09-26 17:16:38.000000000 -0400
@@ -158,6 +158,8 @@ unsigned last_step; // lowest speed step
 // which CPU cores are we controlling
 unsigned tied_cpu_cores[MAX_TIED_CORES];
 unsigned num_tied_cores = 0;
+unsigned cpu = 0;
+bool no_affected_cpus_attr = false;
 
 // display an error message and exit the program
 void
@@ -484,12 +486,16 @@ get_times(
     if (nice_counts_as_idle)
     {
         idle_time += nice_time;
+    } else {
+        user_time += nice_time;
     }
 
     // count IO wait time as idle time
     if (io_counts_as_idle)
     {
         idle_time += wait_time;
+    } else {
+        user_time += wait_time;
     }
 
     unsigned long total_time = user_time + system_time + idle_time;
@@ -710,6 +716,7 @@ unsigned num_cores = 0; // how many CPU 
 // restore  initial speed on program exit
 unsigned saved_speed = 0;
 char saved_governor[32];
+pid_t * saved_pids;
 
 void
 term_handler(int which)
@@ -720,6 +727,12 @@ term_handler(int which)
         write_line(GOVERNOR_FILE, "%s\n", saved_governor);
     }
 
+    if (cpu == 0 && no_affected_cpus_attr)
+    {
+        for (unsigned i = 1; i < num_cores; i++)
+            kill(saved_pids[i], which);
+    }
+
     raise(which);
 }
 
@@ -1032,9 +1045,11 @@ main(int argc, char * argv[])
     //  cpufreq dir for each core
     if (!num_tied_cores)
     {
+        fprintf(stderr, "No cores spec'd, trying to figure it out...\n");
         // iterate through all cpu cores in main process
         for (unsigned i = 0, forked = 0; i < num_cores && !forked; i++)
         {
+	    int n;
             // does this core do cpufreq?
             char cpufreq_dir[256];
             snprintf(cpufreq_dir, sizeof cpufreq_dir, SYSFS_CPUFREQ_DIR, i);
@@ -1066,7 +1081,14 @@ main(int argc, char * argv[])
             }
 #endif
             unsigned cores[MAX_TIED_CORES];
-            int n = read_values(acfn, cores, MAX_TIED_CORES);
+            if (access(acfn, F_OK) != 0)
+            {
+                // fall back to the old 1.2.x method of forking for each core
+                no_affected_cpus_attr = true;
+                n = 1;
+            }
+            else
+                n = read_values(acfn, cores, MAX_TIED_CORES);
 
             // if we can't figure out the affected cores
             if (n == 0)
@@ -1101,8 +1123,22 @@ main(int argc, char * argv[])
                     i, cores[0]
                 );
 #endif
+            if (no_affected_cpus_attr)
+                break;
             }
         }
+
+        if (no_affected_cpus_attr)
+        {
+            saved_pids = (pid_t *)calloc(num_cores, sizeof(pid_t));
+
+            // fork() a process to handle each core
+            for (unsigned i = 1; i < num_cores; i++)
+                if ( !(saved_pids[i] = fork())) {
+                    cpu = i;
+                    break;
+                }
+        }
     }
 
 


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/cpuspeed/devel/.cvsignore,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- .cvsignore	10 Jan 2005 22:58:02 -0000	1.4
+++ .cvsignore	8 Oct 2008 22:57:43 -0000	1.5
@@ -1,2 +1,3 @@
 cpuspeed-1.2.1
 cpuspeed-1.2.1.tar.gz
+cpuspeed-1.5.tar.bz2


Index: cpuspeed.spec
===================================================================
RCS file: /cvs/pkgs/rpms/cpuspeed/devel/cpuspeed.spec,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- cpuspeed.spec	26 Sep 2008 21:23:31 -0000	1.69
+++ cpuspeed.spec	8 Oct 2008 22:57:43 -0000	1.70
@@ -1,12 +1,12 @@
 Summary:        CPU frequency adjusting daemon
 Name:           cpuspeed
-Version:        1.2.1
-Release:        9%{?dist}
+Version:        1.5
+Release:        1%{?dist}
 Epoch:          1
 Group:          System Environment/Base
 License:        GPLv2+
 URL:            http://carlthompson.net/Software/CPUSpeed
-Source0:        http://carlthompson.net/downloads/cpuspeed/cpuspeed-%{version}.tar.gz
+Source0:        http://carlthompson.net/downloads/cpuspeed/cpuspeed-%{version}.tar.bz2
 Source1:        http://carlthompson.net/downloads/cpuspeed/license.txt
 Source2:        cpuspeed.init
 Source3:        cpuspeed.conf
@@ -20,10 +20,8 @@
 ExclusiveArch:	i386 x86_64 ppc ppc64 ia64 sparcv9 sparc64
 Obsoletes:	kernel-utils
 
-Patch1:         cpuspeed-1.2.1-make.patch
-Patch2:         cpuspeed-1.2.1-make-gcc43-happy.patch
-Patch3:         cpuspeed-1.2.1-multicore-support.patch
-Patch4:         cpuspeed-1.2.1-no-affected_cpus-fallback.patch
+Patch1:         cpuspeed-1.5-Makefile.patch
+Patch2:         cpuspeed-1.2.1-no-affected_cpus-fallback.patch
 
 %description
 cpuspeed is a daemon that dynamically changes the speed
@@ -39,9 +37,7 @@
 %setup -q
 cp %{SOURCE1} .
 %patch1 -p1 -b .make
-%patch2 -p1 -b .gcc43
-%patch3 -p1 -b .mc
-%patch4 -p1 -b .ac
+%patch2 -p1 -b .ac
 
 %build
 rm -rf $RPM_BUILD_ROOT
@@ -65,7 +61,7 @@
 
 %files
 %defattr(-,root,root,-)
-%doc license.txt CHANGES EXAMPLES FEATURES README USAGE
+%doc license.txt CHANGES CONTRIBUTORS EXAMPLES FEATURES README USAGE
 %{_sbindir}/cpuspeed
 %{_sysconfdir}/rc.d/init.d/cpuspeed
 %{_mandir}/man8/*
@@ -85,6 +81,9 @@
 exit 0
 
 %changelog
+* Wed Oct 08 2008 Jarod Wilson <jarod at redhat.com> 1.5-1
+- Update to v1.5 release
+
 * Fri Sep 26 2008 Jarod Wilson <jarod at redhat.com> 1.2.1-9
 - backport proper multicore support for userspace governor
   (cpuspeed daemon) case from v1.5 cpuspeed snapshot


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/cpuspeed/devel/sources,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- sources	10 Jan 2005 22:57:14 -0000	1.3
+++ sources	8 Oct 2008 22:57:43 -0000	1.4
@@ -1 +1 @@
-430bed9513bd69d9d864cda5951c2af4  cpuspeed-1.2.1.tar.gz
+4ff58ec10678db80a08bd5ad3589e838  cpuspeed-1.5.tar.bz2


--- cpuspeed-1.2.1-make-gcc43-happy.patch DELETED ---


--- cpuspeed-1.2.1-make.patch DELETED ---


--- cpuspeed-1.2.1-multicore-support.patch DELETED ---


--- cpuspeed-1.2.1-no-affected_cpus-fallback.patch DELETED ---




More information about the scm-commits mailing list