Skip to contentSkip to conversation

package: Add cpulimit

PATCH In review Florian Fainelli 2 participants 2 messages May 5, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 package: Add cpulimit

Cpulimit is a tool which limits the CPU usage of a process (expressed in percentage, not in CPU time). It is useful to control batch jobs, when you don't want them to eat too many CPU cycles.

---
Changes in v3:

- dropped CPULIMIT_SOURCE
- dropped 'v' from CPULIMIT_VERSION
- updated hash file with new tarball name

Changes in v2:

- added DEVELOPERS entry
- back ported 2 patches from upstream project pull requests to address build warnings
- added _GNU_SOURCE to the CFLAGS
- added hash file
- corrected check-package warnings

 DEVELOPERS                                    |  3 +
 package/Config.in                             |  1 +
 ...0001-Fix-crash-and-compiler-warnings.patch | 56 +++++++++++++++++++
 ...l.h-and-add-missing-libgen.h-include.patch | 41 ++++++++++++++
 package/cpulimit/Config.in                    |  7 +++
 package/cpulimit/cpulimit.hash                |  3 +
 package/cpulimit/cpulimit.mk                  | 23 ++++++++
 7 files changed, 134 insertions(+)
 create mode 100644 package/cpulimit/0001-Fix-crash-and-compiler-warnings.patch
 create mode 100644 package/cpulimit/0002-Remove-sys-sysctl.h-and-add-missing-libgen.h-include.patch
 create mode 100644 package/cpulimit/Config.in
 create mode 100644 package/cpulimit/cpulimit.hash
 create mode 100644 package/cpulimit/cpulimit.mk
DEVELOPERS +3 -0
index 292b91913715..c54b6b5c0979 100644
@@ -965,6 +965,9 @@ N:	Filip Skoneczny <[email protected]>
 F:	board/sinovoip/m1-plus
 F:	configs/bananapi_m1_plus_defconfig
 
+N:	Florian Fainelli <[email protected]>
+F:	package/cpulimit/
+
 N:	Floris Bos <[email protected]>
 F:	package/ipmitool/
 F:	package/odhcploc/
package/Config.in +1 -0
index befeadc27b8b..889213413302 100644
@@ -2522,6 +2522,7 @@ menu "System tools"
 	source "package/circus/Config.in"
 	source "package/containerd/Config.in"
 	source "package/coreutils/Config.in"
+	source "package/cpulimit/Config.in"
 	source "package/cpuload/Config.in"
 	source "package/daemon/Config.in"
 	source "package/dc3dd/Config.in"
package/cpulimit/0001-Fix-crash-and-compiler-warnings.patch new file +56 -0

56 lines not on this page · raw message

package/cpulimit/0002-Remove-sys-sysctl.h-and-add-missing-libgen.h-include.patch new file +41 -0

41 lines not on this page · raw message

package/cpulimit/Config.in new file +7 -0
new file mode 100644
index 000000000000..f9f39474a2ab
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_CPULIMIT
+	bool "cpulimit"
+	help
+	  Cpulimit is a tool which limits the CPU usage of a process
+	  (expressed in percentage, not in CPU time)
+
+	  https://github.com/opsengine/cpulimit
package/cpulimit/cpulimit.hash new file +3 -0
new file mode 100644
index 000000000000..c6ef4b2e69d1
@@ -0,0 +1,3 @@
+# sha256sum locally computed:
+sha256  64312f9ac569ddcadb615593cd002c94b76e93a0d4625d3ce1abb49e08e2c2da  cpulimit-0.2.tar.gz
+sha256  920489ca9da706d842870701155e70a101315ba0783cff39765d7e15e0916a4a  LICENSE
package/cpulimit/cpulimit.mk new file +23 -0
new file mode 100644
index 000000000000..a864685a846f
@@ -0,0 +1,23 @@
+################################################################################
+#
+# cpulimit
+#
+################################################################################
+
+CPULIMIT_VERSION = 0.2
+CPULIMIT_SITE = $(call github,opsengine,cpulimit,v$(CPULIMIT_VERSION))
+CPULIMIT_LICENSE = GPL-2.0+
+CPULIMIT_LICENSE_FILES = LICENSE
+
+define CPULIMIT_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \
+		CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE" \
+		LDLIBS="$(TARGET_LDFLAGS)"
+endef
+
+define CPULIMIT_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/src/cpulimit \
+		$(TARGET_DIR)/usr/bin/cpulimit
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 22 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Florian" == Florian Fainelli <[email protected]> writes:

Cpulimit is a tool which limits the CPU usage of a process (expressed in percentage, not in CPU time). It is useful to control batch jobs, when you don't want them to eat too many CPU cycles.

---
Changes in v3:

- dropped CPULIMIT_SOURCE
- dropped 'v' from CPULIMIT_VERSION
- updated hash file with new tarball name

Changes in v2:

- added DEVELOPERS entry
- back ported 2 patches from upstream project pull requests to address build warnings
- added _GNU_SOURCE to the CFLAGS
- added hash file
- corrected check-package warnings

..

package/cpulimit/0001-Fix-crash-and-compiler-warnings.patch line 6

Quoted 8 lines

+++ b/package/cpulimit/0001-Fix-crash-and-compiler-warnings.patch

package/cpulimit/0001-Fix-crash-and-compiler-warnings.patch new file +6 -0
@@ -0,0 +1,56 @@
+From d1f42082590bed42cbf6ef1bf37e936df1afbf6b Mon Sep 17 00:00:00 2001
+From: Tobias Tangemann <[email protected]>
+Date: Thu, 9 Jul 2015 23:51:07 +0200
+Subject: [PATCH] Fix crash (and compiler warnings)
+
+Signed-off-by: Florian Fainelli <[email protected]>

I've added links to the upstream pull requests for both patches.

package/cpulimit/Config.in line 2

Quoted 4 lines
package/cpulimit/Config.in new file +3 -0
+++ b/package/cpulimit/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_CPULIMIT
+	bool "cpulimit"

It uses fork(), so I've added a BR2_USE_MMU dependency.

Committed with these fixes, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot