pmaports/main/bootchart2/20-python3.8.patch
Pops Dylan e068de2de5
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.
2020-01-13 15:43:00 +03:00

41 lines
1.2 KiB
Diff

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