atop: new package
PATCH 1/4 atop: new package
Atop is an ASCII full-screen performance monitor for Linux.
- install only the basic functionality (command line tool atop).
- add patch to fix musl build by removing unused include of termio.h. Patch was accepted upstream.
Support for extra functionality can be added by follow-up patches:
- init scripts (sysv and systemd) to autostart logging the system activity.
- process accounting (needs counterpart enabled in the kernel).
--- package/Config.in | 1 + .../0001-remove-unused-include-of-termio.h.patch | 52 ++++++++++++++++++++++ package/atop/Config.in | 18 ++++++++ package/atop/atop.hash | 2 + package/atop/atop.mk | 21 +++++++++ 5 files changed, 94 insertions(+) create mode 100644 package/atop/0001-remove-unused-include-of-termio.h.patch create mode 100644 package/atop/Config.in create mode 100644 package/atop/atop.hash create mode 100644 package/atop/atop.mk
package/Config.in +1 -0
@@ -1687,6 +1687,7 @@ endmenu menu "System tools" source "package/acl/Config.in" source "package/android-tools/Config.in" + source "package/atop/Config.in" source "package/attr/Config.in" source "package/audit/Config.in" source "package/bootutils/Config.in"
package/atop/0001-remove-unused-include-of-termio.h.patch new file +52 -0
52 lines not on this page · raw message
package/atop/Config.in new file +18 -0
@@ -0,0 +1,18 @@ +config BR2_PACKAGE_ATOP + bool "atop" + depends on BR2_USE_MMU # fork() + select BR2_PACKAGE_NCURSES + select BR2_PACKAGE_ZLIB + help + Atop is an ASCII full-screen performance monitor for Linux + that is capable of reporting the activity of all processes + (even if processes have finished during the interval), daily + logging of system and process activity for long-term analysis, + highlighting overloaded system resources by using colors, etc. + At regular intervals, it shows system-level activity related + to the CPU, memory, swap, disks (including LVM) and network + layers, and for every process (and thread) it shows e.g. the + CPU utilization, memory growth, disk utilization, priority, + username, state, and exit code. + + http://www.atoptool.nl
package/atop/atop.hash new file +2 -0
@@ -0,0 +1,2 @@ +# Locally computed: +sha256 c785b8a2355be28b3de6b58a8ea4c4fcab8fadeaa57a99afeb03c66fac8e055d atop-2.2-3.tar.gz
package/atop/atop.mk new file +21 -0
@@ -0,0 +1,21 @@ +################################################################################ +# +# atop +# +################################################################################ + +ATOP_VERSION = 2.2-3 +ATOP_SITE = http://www.atoptool.nl/download +ATOP_LICENSE = GPLv2+ +ATOP_LICENSE_FILES = COPYING +ATOP_DEPENDENCIES = ncurses zlib + +define ATOP_BUILD_CMDS + $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) +endef + +define ATOP_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 0755 $(@D)/atop $(TARGET_DIR)/usr/bin/atop +endef + +$(eval $(generic-package))
Signature · 1 line
2.9.3
PATCH 2/4 netatop: new package
The optional kernel module netatop can be loaded to gather statistics about the TCP and UDP packets that have been transmitted/received per process and per thread.
- install only the basic functionality (module and init script).
- use a source file as license file. Maintainer will add license file to the next version.
- add patch to init script to support busybox ps.
Patch was accepted upstream.
Support for extra functionality can be added by follow-up patches:
- enable daemon that monitors processes that are finished.
---
- Sample output from atop -n with netatop loaded:
ATOP - buildroot 1970/01/01 00:00:37 ------------- 10s elapsed
PRC | sys 2.61s | user 5.63s | #proc 38 | no procacct | CPU | sys 36% | user 64% | idle 0% | wait 0% | CPL | avg1 0.28 | avg5 0.06 | csw 8323 | intr 4040 | MEM | tot 122.2M | free 110.2M | buff 0.2M | slab 1.9M | SWP | tot 0.0M | free 0.0M | vmcom 7.4M | vmlim 61.1M | NET | transport | tcpo 3038 | udpi 0 | udpo 0 | NET | network | ipo 3038 | ipfrw 0 | deliv 3038 | NET | eth0 0% | pcki 3038 | pcko 3038 | so 389 Kbps |
PID TCPRCV TCPSND UDPSND BANDWI BANDWO NET CMD 1/1
123 3037 3037 0 140 Kbps 398 Kbps 100% dropbear 117 1 1 0 0 Kbps 0 Kbps 0% dropbear 124 0 0 0 0 Kbps 0 Kbps 0% sh
- I first created the patch to fix the init script operation when the daemon is installed. Then I decided to send the minimal package as first version and add more functionalities in follow-up commits. But I noticed the same patch to the init script is needed to make the stop operation exit cleanly (without message like 'can't kill pid' because it tries to kill the grep that is looking for the daemon). So I decided to keep the patch file in these first commits.
--- package/Config.in | 1 + package/atop/Config.in | 3 +++ ...1-Ensure-init-script-stops-the-correct-pid.patch | 21 +++++++++++++++++++++ package/netatop/Config.in | 21 +++++++++++++++++++++ package/netatop/netatop.hash | 2 ++ package/netatop/netatop.mk | 21 +++++++++++++++++++++ 6 files changed, 69 insertions(+) create mode 100644 package/netatop/0001-Ensure-init-script-stops-the-correct-pid.patch create mode 100644 package/netatop/Config.in create mode 100644 package/netatop/netatop.hash create mode 100644 package/netatop/netatop.mk
package/Config.in +1 -0
@@ -95,6 +95,7 @@ menu "Debugging, profiling and benchmark" source "package/lttng-tools/Config.in" source "package/mcelog/Config.in" source "package/memstat/Config.in" + source "package/netatop/Config.in" source "package/netperf/Config.in" source "package/netsniff-ng/Config.in" source "package/oprofile/Config.in"
package/atop/Config.in +3 -0
@@ -15,4 +15,7 @@ config BR2_PACKAGE_ATOP CPU utilization, memory growth, disk utilization, priority, username, state, and exit code. + In combination with the optional kernel module netatop, it + even shows network activity per process/thread. + http://www.atoptool.nl
package/netatop/0001-Ensure-init-script-stops-the-correct-pid.patch new file +21 -0
@@ -0,0 +1,21 @@ +Ensure init script stops the correct pid + +'ps' from busybox shows the pid of grep. +Ignore the pid of the grep process, leaving only the pid of the daemon. + +Patch status: accepted upstream. + +Signed-off-by: Ricardo Martincoski <[email protected]> +--- +diff -purN netatop-1.0.orig/netatop.init netatop-1.0/netatop.init +--- netatop-1.0.orig/netatop.init 2016-07-15 21:22:43.646062649 -0300 ++++ netatop-1.0/netatop.init 2016-07-15 21:37:18.378936625 -0300 +@@ -26,7 +26,7 @@ start() { + } + + stop() { +- PID=$(ps -e | grep netatopd | sed -e 's/^ *//' -e 's/ .*//') ++ PID=$(ps -e | grep -v grep | grep netatopd | sed -e 's/^ *//' -e 's/ .*//') + + if [ "$PID" ] + then
package/netatop/Config.in new file +21 -0
@@ -0,0 +1,21 @@ +config BR2_PACKAGE_NETATOP + bool "netatop" + depends on BR2_USE_MMU # atop + depends on BR2_LINUX_KERNEL + # kernel headers: >= 2.6.24 + select BR2_PACKAGE_ATOP # runtime + help + The optional kernel module netatop can be loaded to gather + statistics about the TCP and UDP packets that have been + transmitted/received per process and per thread. + + Netatop requires a Linux kernel >= 2.6.24 with the following + option enabled: + + - CONFIG_NETFILTER + + http://www.atoptool.nl/netatop.php + +comment "netatop needs a Linux kernel >= 2.6.24 to be built" + depends on BR2_USE_MMU + depends on !BR2_LINUX_KERNEL
package/netatop/netatop.hash new file +2 -0
@@ -0,0 +1,2 @@ +# Locally computed: +sha256 0bdde8315d2c6e4a1d87fd10d27659d76d07949b31f0dc5e81662e67e1d0fdd0 netatop-1.0.tar.gz
package/netatop/netatop.mk new file +21 -0
@@ -0,0 +1,21 @@ +################################################################################ +# +# netatop +# +################################################################################ + +NETATOP_VERSION = 1.0 +NETATOP_SITE = http://www.atoptool.nl/download +NETATOP_LICENSE = GPLv2 +# no license file. It will be added for the next version +NETATOP_LICENSE_FILES = module/netatop.c + +NETATOP_MODULE_SUBDIRS = module + +define NETATOP_INSTALL_INIT_SYSV + $(INSTALL) -D -m 0755 $(@D)/netatop.init \ + $(TARGET_DIR)/etc/init.d/S50netatop +endef + +$(eval $(kernel-module)) +$(eval $(generic-package))
Signature · 1 line
2.9.3
PATCH 2/4 netatop: new package
Hello,
Quoted 25 lines · Ricardo Martincoski
package/netatop/netatop.hash new file +2
-0@@ -0,0 +1,2 @@ +# Locally computed: +sha256 0bdde8315d2c6e4a1d87fd10d27659d76d07949b31f0dc5e81662e67e1d0fdd0 netatop-1.0.tar.gzpackage/netatop/netatop.mk new file +11
-0@@ -0,0 +1,21 @@ +################################################################################ +# +# netatop +# +################################################################################ + +NETATOP_VERSION = 1.0 +NETATOP_SITE = http://www.atoptool.nl/download +NETATOP_LICENSE = GPLv2 +# no license file. It will be added for the next version +NETATOP_LICENSE_FILES = module/netatop.c
package/netatop/netatop.mk line 21
Quoted 10 lines
package/netatop/netatop.mk new file +10
-0+ +NETATOP_MODULE_SUBDIRS = module + +define NETATOP_INSTALL_INIT_SYSV + $(INSTALL) -D -m 0755 $(@D)/netatop.init \ + $(TARGET_DIR)/etc/init.d/S50netatop +endef + +$(eval $(kernel-module)) +$(eval $(generic-package))
In addition to the kernel module, netatop also builds a daemon, netatopd, which gets started by the init script if available. But your .mk file does not seem to build the netatopd daemon. Why so?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 2/4 netatop: new package
Thomas,
On Fri, Oct 07, 2016 at 06:19 PM, Thomas Petazzoni wrote:
[snip]
Quoted 3 lines
In addition to the kernel module, netatop also builds a daemon, netatopd, which gets started by the init script if available. But your .mk file does not seem to build the netatopd daemon. Why so?
Short answer ... for no good reason.
While I was creating the patch series I decided to send a small patch. But I removed too much.
atop and netatop module work without this daemon. But it adds the functionality of tracking counters of exited processes.
I will add the daemon to the .mk file when I resend.
Thank you for your review.
Regards,
Ricardo
PATCH 3/4 netatop: enable required kernel feature
In reply to Ricardo MartincoskiWhen netatop is enabled, the required kernel feature is enabled.
---
Inspired by 4c10eedc103ba9648f73439f1ab5d801da9d2ed7
--- linux/linux.mk | 2 ++ package/netatop/Config.in | 2 ++ 2 files changed, 4 insertions(+)
linux/linux.mk +2 -0
@@ -260,6 +260,8 @@ define LINUX_KCONFIG_FIXUP_CMDS $(call KCONFIG_ENABLE_OPT,CONFIG_ENABLE_DEFAULT_TRACERS,$(@D)/.config) $(call KCONFIG_ENABLE_OPT,CONFIG_PERF_EVENTS,$(@D)/.config) $(call KCONFIG_ENABLE_OPT,CONFIG_FUNCTION_TRACER,$(@D)/.config)) + $(if $(BR2_PACKAGE_NETATOP), + $(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER,$(@D)/.config)) $(if $(BR2_PACKAGE_SYSTEMD), $(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS,$(@D)/.config) $(call KCONFIG_ENABLE_OPT,CONFIG_INOTIFY_USER,$(@D)/.config)
package/netatop/Config.in +2 -0
@@ -14,6 +14,8 @@ config BR2_PACKAGE_NETATOP - CONFIG_NETFILTER + This option will be automatically enabled by Buildroot. + http://www.atoptool.nl/netatop.php comment "netatop needs a Linux kernel >= 2.6.24 to be built"
Signature · 1 line
2.9.3
PATCH 3/4 netatop: enable required kernel feature
Hello,
Quoted 3 lines · Ricardo Martincoski
When netatop is enabled, the required kernel feature is enabled.
Signed-off-by Ricardo Martincoski <[email protected]>
Is CONFIG_NETFILTER=y required to *build* the netatop module, or only needed at runtime ?
Two cases:
- If it's needed to build the netatop module, then this change should be part of the commit adding the netatop package.
- If it's needed only at runtime, we have a more relaxed policy, and we generally don't enforce the kernel options in such a case.
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 3/4 netatop: enable required kernel feature
Thomas,
Quoted 7 lines · Thomas Petazzoni
Quoted 3 lines · Ricardo Martincoski
When netatop is enabled, the required kernel feature is enabled.
Signed-off-by Ricardo Martincoski <[email protected]>Is
CONFIG_NETFILTER=yrequired to *build* the netatop module, or only needed at runtime ?
It is required to build the module.
Quoted 5 lines
Two cases:
- If it's needed to build the netatop module, then this change should be part of the commit adding the netatop package.
Ok. I will send both in one commit when I respin.
Quoted 4 lines
- If it's needed only at runtime, we have a more relaxed policy, and we generally don't enforce the kernel options in such a case.
Thank you for your review.
Regards,
Ricardo
PATCH 4/4 DEVELOPERS: list {, net}atop package under my name
In reply to Ricardo Martincoski--- DEVELOPERS | 4 ++++ 1 file changed, 4 insertions(+)
DEVELOPERS +4 -0
@@ -1203,6 +1203,10 @@ F: package/gupnp-av/ N: Renaud Aubin <[email protected]> F: package/libhttpparser/ +N: Ricardo Martincoski <[email protected]> +F: package/atop/ +F: package/netatop/ + N: Rhys Williams <[email protected]> F: package/lirc-tools/
Signature · 1 line
2.9.3
PATCH 4/4 DEVELOPERS: list {, net}atop package under my name
Hello,
Quoted 10 lines · Ricardo Martincoski
Signed-off-by Ricardo Martincoski <[email protected]>--- DEVELOPERS | 4 ++++ 1 file changed, 4 insertions(+)DEVELOPERS +0
-0
DEVELOPERS F: package/gupnp-av/ · line 1208
Quoted 6 lines
DEVELOPERS +3
-0@@ -1203,6 +1203,10 @@ F: package/gupnp-av/ N: Renaud Aubin <[email protected]> F: package/libhttpparser/ +N: Ricardo Martincoski <[email protected]> +F: package/atop/ +F: package/netatop/
Since I haven't applied the netatop package, I've removed this line, and applied the rest of your patch (so that you receive atop autobuilder failures, if any).
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Thomas Petazzoni
AppliedPATCH 1/4 atop: new package
In reply to Ricardo MartincoskiHello,
Quoted 13 lines · Ricardo Martincoski
Atop is an ASCII full-screen performance monitor for Linux.
- install only the basic functionality (command line tool atop).
- add patch to fix musl build by removing unused include of
termio.h. Patch was accepted upstream.Support for extra functionality can be added by follow-up patches:
- init scripts (sysv and systemd) to autostart logging the system activity.
- process accounting (needs counterpart enabled in the kernel).Signed-off-by Ricardo Martincoski <[email protected]>
Quoted 11 lines
--- package/Config.in | 1 + .../0001-remove-unused-include-of-termio.h.patch | 52 ++++++++++++++++++++++ package/atop/Config.in | 18 ++++++++ package/atop/atop.hash | 2 + package/atop/atop.mk | 21 +++++++++ 5 files changed, 94 insertions(+) create mode 100644 package/atop/0001-remove-unused-include-of-termio.h.patch create mode 100644 package/atop/Config.in create mode 100644 package/atop/atop.hash create mode 100644 package/atop/atop.mk
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com