mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
Add bootchart2.
This commit is contained in:
parent
1ce684c01e
commit
5771b3bde6
5 changed files with 159 additions and 0 deletions
43
bootchart2/Makefile
Normal file
43
bootchart2/Makefile
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#
|
||||
# Copyright (C) 2007-2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bootchart2
|
||||
PKG_VERSION:=0.14.7
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/mmeeks/bootchart.git
|
||||
PKG_SOURCE_VERSION:=3ab81137cafe25c2ca4bc3a5f322a63646f9ce8d
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bootchart2
|
||||
SECTION:=base
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Bootchart2
|
||||
URL:=https://github.com/mmeeks/bootchart
|
||||
endef
|
||||
|
||||
define Package/bootchart2/description
|
||||
Bootchart is a tool for performance analysis and visualization of the GNU/Linux boot process.
|
||||
endef
|
||||
|
||||
define Package/bootchart2/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bootchart-collector $(1)/sbin
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,bootchart2))
|
||||
10
bootchart2/files/lib/preinit/11_bootchart
Normal file
10
bootchart2/files/lib/preinit/11_bootchart
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
do_bootchart()
|
||||
{
|
||||
[ -f /dev/null ] || mknod /dev/null c 1 3
|
||||
mkdir -p /lib/bootchart/tmpfs
|
||||
echo "starting bootchart"
|
||||
/sbin/bootchart_run_preinit boot &
|
||||
}
|
||||
|
||||
boot_hook_add preinit_essential do_bootchart
|
||||
7
bootchart2/files/lib/preinit/72_bootchart
Normal file
7
bootchart2/files/lib/preinit/72_bootchart
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
bootchart_rootfs_pivot()
|
||||
{
|
||||
mount -o move /rom/lib/bootchart/tmpfs /lib/bootchart/tmpfs
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root bootchart_rootfs_pivot
|
||||
59
bootchart2/files/sbin/bootchart_run_preinit
Executable file
59
bootchart2/files/sbin/bootchart_run_preinit
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
#! /bin/sh
|
||||
# this is intended to be started in preinit.
|
||||
# 11_bootchart, starts it
|
||||
# 72_bootchart, fixup mount point after pivot
|
||||
#
|
||||
# program can be killed early with
|
||||
# bootchart_run_preinit stop
|
||||
|
||||
trap "stop; exit 0;" SIGINT SIGTERM
|
||||
|
||||
STOP_AFTER=250
|
||||
HZ=50
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "you need to specify start or stop"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
start()
|
||||
{
|
||||
/sbin/bootchart-collector $HZ &
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
echo "bootchart DUMP"
|
||||
|
||||
mkdir /tmp/bootchart
|
||||
/sbin/bootchart-collector --dump /tmp/bootchart
|
||||
cd /tmp/bootchart
|
||||
tar -zcf /tmp/bootchart.tgz header *.log
|
||||
cd /
|
||||
rm -rf /tmp/bootchart
|
||||
}
|
||||
|
||||
case $1 in
|
||||
boot) # secret option for preinit
|
||||
start
|
||||
sleep $STOP_AFTER
|
||||
# test to see if someone has manually killed us
|
||||
if [ -f /tmp/bootchart.tgz ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
stop
|
||||
;;
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
*)
|
||||
echo "you need to specify start or stop, not $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
40
bootchart2/patches/0001-add_spu_sys_time.patch
Normal file
40
bootchart2/patches/0001-add_spu_sys_time.patch
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
diff --git a/pybootchartgui/draw.py b/pybootchartgui/draw.py
|
||||
index 7c3f60c..5c9f046 100644
|
||||
--- a/pybootchartgui/draw.py
|
||||
+++ b/pybootchartgui/draw.py
|
||||
@@ -63,6 +63,7 @@ AXIS_FONT_SIZE = 11
|
||||
LEGEND_FONT_SIZE = 12
|
||||
|
||||
# CPU load chart color.
|
||||
+CPU_SYS_COLOR = (0.65, 0.13, 0.36, 1.0)
|
||||
CPU_COLOR = (0.40, 0.55, 0.70, 1.0)
|
||||
# IO wait chart color.
|
||||
IO_COLOR = (0.76, 0.48, 0.48, 0.5)
|
||||
@@ -300,21 +301,19 @@ def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w):
|
||||
# render bar legend
|
||||
ctx.set_font_size(LEGEND_FONT_SIZE)
|
||||
|
||||
- draw_legend_box(ctx, "CPU (user+sys)", CPU_COLOR, off_x, curr_y+20, leg_s)
|
||||
- draw_legend_box(ctx, "I/O (wait)", IO_COLOR, off_x + 120, curr_y+20, leg_s)
|
||||
+ draw_legend_box(ctx, "CPU (user)", CPU_COLOR, off_x, curr_y+20, leg_s)
|
||||
+ draw_legend_box(ctx, "CPU (sys)", CPU_SYS_COLOR, off_x + 120, curr_y+20, leg_s)
|
||||
+ draw_legend_box(ctx, "I/O (wait)", IO_COLOR, off_x + 120 + 120 , curr_y+20, leg_s)
|
||||
|
||||
# render I/O wait
|
||||
chart_rect = (off_x, curr_y+30, w, bar_h)
|
||||
if clip_visible (clip, chart_rect):
|
||||
draw_box_ticks (ctx, chart_rect, sec_w)
|
||||
draw_annotations (ctx, proc_tree, trace.times, chart_rect)
|
||||
- draw_chart (ctx, IO_COLOR, True, chart_rect, \
|
||||
- [(sample.time, sample.user + sample.sys + sample.io) for sample in trace.cpu_stats], \
|
||||
- proc_tree, None)
|
||||
+ draw_chart (ctx, IO_COLOR, True, chart_rect, [(sample.time, sample.user + sample.sys + sample.io) for sample in trace.cpu_stats], proc_tree, None)
|
||||
# render CPU load
|
||||
- draw_chart (ctx, CPU_COLOR, True, chart_rect, \
|
||||
- [(sample.time, sample.user + sample.sys) for sample in trace.cpu_stats], \
|
||||
- proc_tree, None)
|
||||
+ draw_chart (ctx, CPU_SYS_COLOR, True, chart_rect, [(sample.time, sample.user + sample.sys) for sample in trace.cpu_stats], proc_tree, None)
|
||||
+ draw_chart (ctx, CPU_COLOR, True, chart_rect, [(sample.time, sample.user ) for sample in trace.cpu_stats], proc_tree, None)
|
||||
|
||||
curr_y = curr_y + 30 + bar_h
|
||||
|
||||
Loading…
Add table
Reference in a new issue