Imported Upstream version 1.5 upstream/1.5
authorgregor herrmann <gregoa@debian.org>
Tue, 21 Feb 2012 18:45:14 +0000 (19:45 +0100)
committergregor herrmann <gregoa@debian.org>
Tue, 21 Feb 2012 18:45:14 +0000 (19:45 +0100)
CHANGELOG
Makefile
README
TODO [new file with mode: 0644]
cpulimit.1.gz
cpulimit.c

index 7548095460d37eb62d54fc458cb11679375e970e..8b23d623d00a87438670d755bcc6a8244117d6e9 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,16 @@
+======== Changes in 1.5 ============
+
+* Updated man page and cpulimit's "--help" page to
+  reflect support for multi-core CPUs.
+
+* Added example of using cpulimit in a shell
+  in the man page and the README file.
+
+* The Makefile now uses the default compiler
+  on the system, "cc", and tries to fall back
+  on gcc if no other compiler is found.
+
+
 ======== Changes in 1.4 ============
 
 * We can now accept limits of 100% or higher. Useful for multi-core
index 22a954eb73e98d65b193d8d819cac789f136973e..b696393aec3967d096f9951b4459b7fba7613851 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,11 @@
 PREFIX?=/usr
 CFLAGS?=-Wall -O2
+CC?=gcc
 
 all: cpulimit
 
 cpulimit: cpulimit.c
-       gcc -o cpulimit cpulimit.c -lrt $(CFLAGS)
+       $(CC) -o cpulimit cpulimit.c -lrt $(CFLAGS)
 
 install: cpulimit
        mkdir -p ${PREFIX}/bin
diff --git a/README b/README
index d1e6a04321b06f3ccecaa6c6a72d416dac391015..6f5f1032209405245c23a71c7b099e401e6dc193 100644 (file)
--- a/README
+++ b/README
@@ -42,11 +42,11 @@ How to compile and install
 Once you have downloaded a copy of LimitCPU building should be fairly
 straight forward. First we unpack the source code
 
-tar zxf cpulimit-1.4.tar.gz
+tar zxf cpulimit-1.5.tar.gz
 
 Then we run the makefile.
 
-cd cpulimit-1.4
+cd cpulimit-1.5
 make
 
 This should produce the executable file "cpulimit". If you would like
@@ -93,6 +93,14 @@ cpulimit --exec /usr/bin/bigexe --limit 50 -z
 The "-z" flag tells LimitCPU to stop running once its target is
 no longer running itself.
 
+The following example is useful for scripts where we want
+to launch a program and then immediately throttle it
+without knowing its process ID. The "$!" symbol refers to
+the last program run and the -b flag tells cpulimit to
+run in the background, returning control to the shell.
+
+/usr/bin/someapp &
+cpulimit -p $! -l 25 -b
 
 
 
diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
+++ b/TODO
@@ -0,0 +1 @@
+
index 43ad45549a466c9c787f7343a0e6bad914b16bf9..d002287d90d898d7efccd84ce034cef49d65b77b 100644 (file)
Binary files a/cpulimit.1.gz and b/cpulimit.1.gz differ
index ba41986e10175b63d8b3c3a9d9bfe58f902412da..709bda17755fdd91868349757c56396e5fa8b41e 100644 (file)
@@ -353,12 +353,18 @@ void print_usage(FILE *stream,int exit_code) {
        fprintf(stream, "   TARGET must be exactly one of these:\n");
        fprintf(stream, "      -p, --pid=N        pid of the process\n");
        fprintf(stream, "      -e, --exe=FILE     name of the executable program file\n");
-       fprintf(stream, "      -P, --path=PATH    absolute path name of the executable program file\n");
+        fprintf(stream, "                         The -e option only works when\n");
+        fprintf(stream, "                         cpulimit is run with admin rights.\n");
+       fprintf(stream, "      -P, --path=PATH    absolute path name of the\n");
+        fprintf(stream, "                         executable program file\n");
        fprintf(stream, "   OPTIONS\n");
         fprintf(stream, "      -b  --background   run in background\n");
-       fprintf(stream, "      -l, --limit=N      percentage of cpu allowed from 0 to 100 (mandatory)\n");
+       fprintf(stream, "      -l, --limit=N      percentage of cpu allowed from 1 up.\n");
+        fprintf(stream, "                         Usually 1 - 100, but can be higher\n");
+        fprintf(stream, "                         on multi-core CPUs (mandatory)\n");
        fprintf(stream, "      -v, --verbose      show control statistics\n");
-       fprintf(stream, "      -z, --lazy         exit if there is no suitable target process, or if it dies\n");
+       fprintf(stream, "      -z, --lazy         exit if there is no suitable target process,\n");
+        fprintf(stream, "                         or if it dies\n");
        fprintf(stream, "      -h, --help         display this help and exit\n");
        exit(exit_code);
 }