Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest updates #84

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Dockerfile.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# Build a LinuxKit rootfs for the bootchartd

FROM scratch


ADD bootchartd /sbin/
ADD bootchartd.conf /etc/
ADD bootchart-collector /lib/bootchart/

12 changes: 12 additions & 0 deletions Dockerfile.pybootchartgui
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM alpine

RUN apk add --no-cache python py2-cairo

WORKDIR /bootchart/

ADD pybootchartgui /bootchart/pybootchartgui/
ADD pybootchartgui.py /bootchart/
ADD pybootchartgui.1 /bootchart/

ENTRYPOINT ["./pybootchartgui.py", "--output", "/var/log/", "--show-all", "--format", "svg"]
#, "--no-prune"]
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ PKG_NAME=bootchart2
PKG_TARBALL=$(PKG_NAME)-$(VER).tar.bz2

CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
CC = $(CROSS_COMPILE)gcc

CC ?= $(CROSS_COMPILE)gcc
CFLAGS ?= -g -Wall -O0
CPPFLAGS ?=

Expand Down Expand Up @@ -82,7 +82,7 @@ bootchartd: bootchartd.in
$(substitute_variables) $^ > $@

bootchart-collector: $(COLLECTOR)
$(CC) $(CFLAGS) $(LDFLAGS) -pthread -Icollector -o $@ $^
$(CC) $(CFLAGS) $(LDFLAGS) -static -pthread -Icollector -o $@ $^

pybootchartgui/main.py: pybootchartgui/main.py.in
$(substitute_variables) $^ > $@
Expand Down Expand Up @@ -136,3 +136,9 @@ test: pybootchartgui/tests
echo "Testing $$f...";\
$(PYTHON) "$$f";\
done

docker-init: all
docker build -t svendowideit/bootchart:init -f Dockerfile.init .

docker-py: all
docker build -t svendowideit/bootchart:pybootchartgui -f Dockerfile.pybootchartgui .
17 changes: 1 addition & 16 deletions bootchartd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
16 changes: 1 addition & 15 deletions bootchartd.in
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
1 change: 1 addition & 0 deletions collector/collector.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <linux/taskstats.h>
#include <linux/cgroupstats.h>
#include <signal.h>
#include <sys/sysmacros.h>

/* pid uniqifying code */
typedef struct {
Expand Down
2 changes: 1 addition & 1 deletion pybootchartgui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
#
# This file is part of pybootchartgui.

Expand Down
16 changes: 10 additions & 6 deletions pybootchartgui/main.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions pybootchartgui/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import re
import sys
import tarfile
from time import clock
from time import perf_counter
from collections import defaultdict
from functools import reduce

Expand Down Expand Up @@ -526,7 +526,7 @@ def _parse_dmesg(writer, file):
processMap['k-boot'] = kernel
base_ts = False
max_ts = 0
for line in file.read().decode('utf-8').split('\n'):
for line in file.read().decode('utf-8', 'replace').split('\n'):
t = timestamp_re.match (line)
if t is None:
# print "duff timestamp " + line
Expand Down Expand Up @@ -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":
Expand All @@ -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

Expand Down