sys-process/ctop: initial import of version 0.4.1

This commit is contained in:
Julian Ospald 2016-02-29 16:13:21 +01:00
parent 87ca15d3d4
commit d908fdef9d
4 changed files with 86 additions and 0 deletions

View File

@ -28,6 +28,7 @@ net-misc
net-www net-www
sci-mathematics sci-mathematics
sys-apps sys-apps
sys-process
voip voip
www-apps www-apps
www-servers www-servers

View File

@ -0,0 +1,20 @@
# Copyright 2016 Julian Ospald <hasufell@posteo.de>
# Distributed under the terms of the GNU General Public License v2
require setup-py [ import=setuptools multibuild=false ]
SUMMARY="A lightweight top like monitor for linux CGroups"
HOMEPAGE="https://github.com/yadutaf/ctop https://pypi.python.org/pypi/ctop"
DOWNLOADS="https://github.com/yadutaf/ctop/archive/v${PV}.tar.gz -> ${PNV}.tar.gz"
LICENCES="MIT"
SLOT="0"
PLATFORMS="~amd64 ~x86"
MYOPTIONS=""
# upstream backports
DEFAULT_SRC_PREPARE_PATCHES=(
"${FILES}"/${PNV}-rel-paths.patch
"${FILES}"/${PNV}-blkio.patch
)

View File

@ -0,0 +1,38 @@
From 093d4c2b604f6e94d01420c0937d5fe574c49a40 Mon Sep 17 00:00:00 2001
From: Jean-Tiare Le Bigot <jt@yadutaf.fr>
Date: Tue, 19 Jan 2016 08:36:07 +0100
Subject: [PATCH] workaround broken blkio on some system. Fixes #15
---
cgroup_top.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/cgroup_top.py b/cgroup_top.py
index fece4a6..8bbb8f0 100755
--- a/cgroup_top.py
+++ b/cgroup_top.py
@@ -26,6 +26,7 @@
import pwd
import time
import pty
+import errno
import subprocess
import multiprocessing
@@ -346,8 +347,14 @@ def collect(measures):
collect_ensure_common(cur[cgroup.name], cgroup)
# Collect BlockIO stats
- cur[cgroup.name]['blkio.throttle.io_service_bytes'] = cgroup['blkio.throttle.io_service_bytes']
- cur[cgroup.name]['blkio.throttle.io_service_bytes.diff'] = {'total':0}
+ try:
+ cur[cgroup.name]['blkio.throttle.io_service_bytes'] = cgroup['blkio.throttle.io_service_bytes']
+ cur[cgroup.name]['blkio.throttle.io_service_bytes.diff'] = {'total':0}
+ except IOError as e:
+ # Workaround broken systems (see #15)
+ if e.errno == errno.ENOENT:
+ continue
+ raise
# Collect BlockIO increase on run > 1
if cgroup.name in prev:

View File

@ -0,0 +1,27 @@
From 180b94124cc17afa60cd9126fee2e004a26c43f2 Mon Sep 17 00:00:00 2001
From: Jean-Tiare Le Bigot <jt@yadutaf.fr>
Date: Fri, 15 May 2015 22:21:26 +0200
Subject: [PATCH] fix #7: use relative path to which
Signed-off-by: Jean-Tiare Le Bigot <jt@yadutaf.fr>
---
CHANGELOG | 1 +
cgroup_top.py | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/cgroup_top.py b/cgroup_top.py
index f073518..6a1ea66 100755
--- a/cgroup_top.py
+++ b/cgroup_top.py
@@ -41,7 +41,10 @@
sys.exit(0)
def cmd_exists(cmd):
- return subprocess.call(["/bin/which", cmd], stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0
+ try:
+ return subprocess.call(["which", cmd], stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0
+ except OSError:
+ return False
HAS_LXC = cmd_exists('lxc-start')
HAS_DOCKER = cmd_exists('docker')