main/bootchart2: new aport (!852)
Port bootchart2 to PostmarketOS, with three patches: 1. Modification of /etc/bootchartd.conf so that the collector will stop after sshd has started. 2. Python 3.8 compatibility 3. Disable the interactive mode of pybootchartgui. Use bootchart2 to profile system boot or a running system. 1. Add the bootchart2 package to your device. 2. Add the following kernel command line parameters: initcall_debug printk.time=y quiet 3. To profile system boot a. add the following kernel command line parameter: PMOS_BOOTCHART2. This parameter causes mkinitfs to start /sbin/bootchartd instead of /sbin/init. /sbin/bootchartd then starts /sbin/init. b. (optional) modify EXIT_PROC in /etc/bootchartd.conf to define when the collector is to stop. c. Boot the system. Approximately 20 seconds after sshd starts (if using the default value of EXIT_PROC), the collector will exit. 4. To profile a running system a. use the command '/sbin/bootchartd start' (as root) to start profiling b. use the command '/sbin/bootchartd stop' (as root) to stop profiling 5. When the collector exits, /usr/bin/pybootchartgui will create a visualization in /var/log/bootchart.png.
This commit is contained in:
parent
489a496442
commit
e068de2de5
4 changed files with 164 additions and 0 deletions
52
main/bootchart2/10-set-EXIT_PROC.patch
Normal file
52
main/bootchart2/10-set-EXIT_PROC.patch
Normal file
|
@ -0,0 +1,52 @@
|
|||
diff --git a/bootchartd.conf b/bootchartd.conf
|
||||
index 7c45cb5..9599451 100644
|
||||
--- a/bootchartd.conf
|
||||
+++ b/bootchartd.conf
|
||||
@@ -30,19 +30,4 @@ AUTO_RENDER_DIR="/var/log"
|
||||
CUSTOM_POST_CMD=""
|
||||
|
||||
# The processes we have to wait for
|
||||
-EXIT_PROC="compiz \
|
||||
- enlightenment \
|
||||
- fluxbox \
|
||||
- gnome-shell \
|
||||
- gnome-terminal \
|
||||
- icewm-session \
|
||||
- kdm_greet \
|
||||
- konsole \
|
||||
- ldm \
|
||||
- lightdm-gtk-greeter \
|
||||
- metacity \
|
||||
- mutter \
|
||||
- openbox \
|
||||
- sddm-helper \
|
||||
- xfwm4 \
|
||||
- xterm"
|
||||
+EXIT_PROC="sshd"
|
||||
diff --git a/bootchartd.in b/bootchartd.in
|
||||
index 7979ef9..d1709eb 100755
|
||||
--- a/bootchartd.in
|
||||
+++ b/bootchartd.in
|
||||
@@ -43,21 +43,7 @@ AUTO_RENDER_DIR="/var/log"
|
||||
AUTO_RENDER_FORMAT="png"
|
||||
|
||||
# The processes we have to wait for
|
||||
-EXIT_PROC="compiz \
|
||||
- enlightenment \
|
||||
- fluxbox \
|
||||
- gnome-shell \
|
||||
- gnome-terminal \
|
||||
- icewm-session \
|
||||
- kdm_greet \
|
||||
- konsole \
|
||||
- ldm \
|
||||
- lightdm-gtk-greeter \
|
||||
- metacity \
|
||||
- mutter \
|
||||
- openbox \
|
||||
- xfwm4 \
|
||||
- xterm"
|
||||
+EXIT_PROC="sshd"
|
||||
|
||||
# Read configuration.
|
||||
CONFBASE="${PROGRAM_PREFIX}bootchartd${PROGRAM_SUFFIX}"
|
41
main/bootchart2/20-python3.8.patch
Normal file
41
main/bootchart2/20-python3.8.patch
Normal file
|
@ -0,0 +1,41 @@
|
|||
diff --git a/pybootchartgui.py b/pybootchartgui.py
|
||||
index 947ce10..55f56ca 100755
|
||||
--- a/pybootchartgui.py
|
||||
+++ b/pybootchartgui.py
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/python
|
||||
+#!/usr/bin/python3
|
||||
#
|
||||
# This file is part of pybootchartgui.
|
||||
|
||||
diff --git a/pybootchartgui/parsing.py b/pybootchartgui/parsing.py
|
||||
index 993d7bf..433eb8b 100644
|
||||
--- a/pybootchartgui/parsing.py
|
||||
+++ b/pybootchartgui/parsing.py
|
||||
@@ -23,7 +23,7 @@ import string
|
||||
import re
|
||||
import sys
|
||||
import tarfile
|
||||
-from time import clock
|
||||
+from time import perf_counter
|
||||
from collections import defaultdict
|
||||
from functools import reduce
|
||||
|
||||
@@ -658,7 +658,7 @@ def get_num_cpus(headers):
|
||||
|
||||
def _do_parse(writer, state, name, file):
|
||||
writer.status("parsing '%s'" % name)
|
||||
- t1 = clock()
|
||||
+ t1 = perf_counter()
|
||||
if name == "header":
|
||||
state.headers = _parse_headers(file)
|
||||
elif name == "proc_diskstats.log":
|
||||
@@ -680,7 +680,7 @@ def _do_parse(writer, state, name, file):
|
||||
state.ps_stats = _parse_proc_ps_log(writer, file)
|
||||
elif name == "kernel_pacct": # obsoleted by PROC_EVENTS
|
||||
state.parent_map = _parse_pacct(writer, file)
|
||||
- t2 = clock()
|
||||
+ t2 = perf_counter()
|
||||
writer.info(" %s seconds" % str(t2-t1))
|
||||
return state
|
||||
|
34
main/bootchart2/30-disable-interactive-mode.patch
Normal file
34
main/bootchart2/30-disable-interactive-mode.patch
Normal file
|
@ -0,0 +1,34 @@
|
|||
diff --git a/pybootchartgui/main.py.in b/pybootchartgui/main.py.in
|
||||
index e809198..164fcf3 100644
|
||||
--- a/pybootchartgui/main.py.in
|
||||
+++ b/pybootchartgui/main.py.in
|
||||
@@ -30,8 +30,10 @@ def _mk_options_parser():
|
||||
usage = "%prog [options] PATH, ..., PATH"
|
||||
version = "%prog v@VER@"
|
||||
parser = optparse.OptionParser(usage, version=version)
|
||||
- parser.add_option("-i", "--interactive", action="store_true", dest="interactive", default=False,
|
||||
- help="start in active mode")
|
||||
+ # PostmarketOS: Remove interactive mode. gui.py would need changes for compatibility
|
||||
+ # with the py3-gobject3 package.
|
||||
+ # parser.add_option("-i", "--interactive", action="store_true", dest="interactive", default=False,
|
||||
+ # help="start in active mode")
|
||||
parser.add_option("-f", "--format", dest="format", default="png", choices=["png", "svg", "pdf"],
|
||||
help="image format (png, svg, pdf); default format png")
|
||||
parser.add_option("-o", "--output", dest="output", metavar="PATH", default=None,
|
||||
@@ -123,10 +125,12 @@ def main(argv=None):
|
||||
|
||||
trace = parsing.Trace(writer, args, options)
|
||||
|
||||
- if options.interactive:
|
||||
- from . import gui
|
||||
- gui.show(trace, options)
|
||||
- elif options.boottime:
|
||||
+ # PostmarketOS: Remove interactive mode
|
||||
+ # if options.interactive:
|
||||
+ # from . import gui
|
||||
+ # gui.show(trace, options)
|
||||
+ #elif options.boottime:
|
||||
+ if options.boottime:
|
||||
import math
|
||||
proc_tree = trace.proc_tree
|
||||
if proc_tree.idle:
|
37
main/bootchart2/APKBUILD
Normal file
37
main/bootchart2/APKBUILD
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Contributor: Pops Dylan <popsdylan@protonmail.com>
|
||||
# Maintainer: Pops Dylan <popsdylan@protonmail.com>
|
||||
pkgname="bootchart2"
|
||||
pkgver="0.14.8_git20170531"
|
||||
pkgrel=0
|
||||
pkgdesc="Boot Process Performance Visualization"
|
||||
url="https://github.com/xrmx/bootchart"
|
||||
arch="all"
|
||||
license="GPL-2.0-only"
|
||||
depends="python3 py3-cairo"
|
||||
makedepends="$depends_dev sed linux-headers"
|
||||
subpackages="$pkgname-doc"
|
||||
_commit="331ada031f1d65f6d934d918f896e1c708c64bf7"
|
||||
source="bootchart-$_commit.tar.gz::https://github.com/xrmx/bootchart/archive/$_commit.tar.gz
|
||||
10-set-EXIT_PROC.patch 20-python3.8.patch 30-disable-interactive-mode.patch"
|
||||
builddir="$srcdir/bootchart-$_commit"
|
||||
options="!check"
|
||||
|
||||
build() {
|
||||
make PYTHON=python3 all
|
||||
}
|
||||
|
||||
check() {
|
||||
make check
|
||||
}
|
||||
|
||||
package() {
|
||||
# install everything but the service
|
||||
for target in "py-install-compile" "install-collector" "install-docs"; do
|
||||
make PYTHON=python3 DESTDIR="$pkgdir" "$target"
|
||||
done
|
||||
}
|
||||
|
||||
sha512sums="7efd409366679cb50d8fd6b9414f96d115c17f14e01508ac74f845529303bdbdae70ba14adfc89c78e3b11f2da62307c9e1d5e696ea666147c5a89e1222a02d3 bootchart-331ada031f1d65f6d934d918f896e1c708c64bf7.tar.gz
|
||||
0ab20745b0eb360ca1795017f3f2e18b39097f7720816f636d69e91fa01eba7d2fc8971e20d5ab73cff17c89174051982ea8d676319848fb8dee3d2cdbccbd79 10-set-EXIT_PROC.patch
|
||||
816298ad0d586e3272a0dbca298ef8cc758c6b37bdc3ea01746be9dc32987492118da81ff2ea280c4649d35fadd8c644ef332410ccc7a3d7a91288507a22a1d2 20-python3.8.patch
|
||||
2e8abf01a9b5efae93b587c949626d0357db1857da051d5418150df0ac01f62a42606d2af99e4a3934514587748cb30fcf55434cc0940e750b41095897ca5e69 30-disable-interactive-mode.patch"
|
Loading…
Reference in a new issue