summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <uberlord@gentoo.org>2006-08-15 11:44:28 +0000
committerRoy Marples <uberlord@gentoo.org>2006-08-15 11:44:28 +0000
commit55845fa344fc95d17727617be524f30b38d62614 (patch)
tree4568bae0f740b3b1c6300a55c6a3e407732fba53 /app-benchmarks/bootchart/files
parentDEPEND=dev-libs/zziplib -> sys-libs/zlib. (diff)
downloadgentoo-2-55845fa344fc95d17727617be524f30b38d62614.tar.gz
gentoo-2-55845fa344fc95d17727617be524f30b38d62614.tar.bz2
gentoo-2-55845fa344fc95d17727617be524f30b38d62614.zip
Initial import, #74425 thanks to Paul Pacheco.
(Portage version: 2.1.1_pre5-r1)
Diffstat (limited to 'app-benchmarks/bootchart/files')
-rw-r--r--app-benchmarks/bootchart/files/bootchart7
-rw-r--r--app-benchmarks/bootchart/files/bootchart-0.9-gentoo.patch48
-rw-r--r--app-benchmarks/bootchart/files/digest-bootchart-0.93
-rw-r--r--app-benchmarks/bootchart/files/profiling-functions.sh86
4 files changed, 144 insertions, 0 deletions
diff --git a/app-benchmarks/bootchart/files/bootchart b/app-benchmarks/bootchart/files/bootchart
new file mode 100644
index 000000000000..812f6be2ca52
--- /dev/null
+++ b/app-benchmarks/bootchart/files/bootchart
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+. /etc/profile
+
+java -Djava.awt.headless=true \
+ -cp "$(java-config -p commons-cli-1):$(java-config -pbootchart)" \
+ org.bootchart.Main "$@"
diff --git a/app-benchmarks/bootchart/files/bootchart-0.9-gentoo.patch b/app-benchmarks/bootchart/files/bootchart-0.9-gentoo.patch
new file mode 100644
index 000000000000..af85b1b2477c
--- /dev/null
+++ b/app-benchmarks/bootchart/files/bootchart-0.9-gentoo.patch
@@ -0,0 +1,48 @@
+Get bootchart to mount $LOG_DIR to /lib/bootchart so our profiling
+functions know where to create init_pidname.log
+
+--- script.orig/bootchartd 2005-11-13 17:40:01.000000000 +0000
++++ script/bootchartd 2006-08-04 13:25:00.000000000 +0100
+@@ -27,16 +27,15 @@
+ elif [ -f $CONF ]; then
+ . $CONF
+ else
+- echo "$CONF missing"
++ echo "$CONF missing" >&2
+ exit 1
+ fi
+
+-
+ # Start the boot logger.
+ start()
+ {
+ # Make sure only a single instance is running
+- [ -f "$BOOTLOG_LOCK" ] && return
++ [ -f "/lib/bootchart/$BOOTLOG_LOCK" ] && return
+
+ # Mount the temporary file system for log file storage. If possible,
+ # a temporary directory is created. In most cases though (i.e. during
+@@ -49,8 +48,13 @@
+ LAZY_UMOUNT="yes"
+ mount -n -t tmpfs -o size=$TMPFS_SIZE none "$LOG_DIR" >/dev/null 2>&1
+ fi
++
+ cd "$LOG_DIR"
+ > "$BOOTLOG_LOCK"
++
++ # OK, now bind to a fixed directory so we can create init_pidname.log
++ mount --bind "$LOG_DIR" /lib/bootchart
++
+ [ -n "$LAZY_UMOUNT" ] && umount -nfl "$LOG_DIR"
+
+ # Enable process accounting if configured
+@@ -168,6 +172,9 @@
+ rmdir "$LOG_DIR"
+ fi
+
++ # We're done, so we can release the mount
++ umount /lib/bootchart
++
+ # Render the chart if configured (and the renderer is installed)
+ [ "$AUTO_RENDER" = "yes" -a -x /usr/bin/bootchart ] && \
+ /usr/bin/bootchart -o "$AUTO_RENDER_DIR" -f $AUTO_RENDER_FORMAT "$BOOTLOG_DEST"
diff --git a/app-benchmarks/bootchart/files/digest-bootchart-0.9 b/app-benchmarks/bootchart/files/digest-bootchart-0.9
new file mode 100644
index 000000000000..8488ebb31c32
--- /dev/null
+++ b/app-benchmarks/bootchart/files/digest-bootchart-0.9
@@ -0,0 +1,3 @@
+MD5 4be91177d19069e21beeb106f2f77dff bootchart-0.9.tar.bz2 222558
+RMD160 c271bf634117c9bcd530055927abffead134b73a bootchart-0.9.tar.bz2 222558
+SHA256 7738399ecfcfb2242e9f99a316b13a5f59e89052de05074dbf705ccf4edc327d bootchart-0.9.tar.bz2 222558
diff --git a/app-benchmarks/bootchart/files/profiling-functions.sh b/app-benchmarks/bootchart/files/profiling-functions.sh
new file mode 100644
index 000000000000..28ca599713ab
--- /dev/null
+++ b/app-benchmarks/bootchart/files/profiling-functions.sh
@@ -0,0 +1,86 @@
+# profiling hook script for bootchart in baselayout
+
+[[ -e /etc/bootchartd.conf ]] && . /etc/bootchartd.conf
+
+BC_LOG_DIR=/lib/bootchart
+BC_PID_LOG="${BC_LOG_DIR}/init_pidname.log"
+BC_PID_LOCK="${BC_LOG_DIR}/init_pidname.lock"
+BC_LOCK="${BC_LOG_DIR}/${BOOTLOG_LOCK}"
+
+profiling() {
+ [[ ${RC_BOOTCHART} == "yes" && -x /sbin/bootchartd ]] || return 0
+
+ local opt="$1"
+ shift
+
+ case "${opt}" in
+ start)
+ profiling_start "$@"
+ ;;
+ name)
+ profiling_name "$@"
+ ;;
+ esac
+}
+
+# Gets a lock, or blocks until the lock is released and then gets the lock
+profiling_get_lock()
+{
+ local lockfile="$1" buffer=
+
+ while ! mkfifo "${lockfile}" &> /dev/null ; do
+ buffer=$(<"${lockfile}")
+ done
+}
+
+# Releases a lock and wakes up whoever is waiting on the lock
+profiling_release_lock()
+{
+ local lockfile="$1" tempname=$(mktemp "$1.XXXXXXXXXX")
+
+ mv -f "${lockfile}" "${tempname}"
+ touch "${tempname}"
+ rm -f "${tempname}"
+}
+
+profiling_name()
+{
+ local line= subroutine= file= frame=
+
+ # $$ does not work in subshels, that is why finding out
+ # my pid is so nasty
+ if [[ -f $BC_LOCK ]]; then
+
+ # when doing parallel startup, this function can be called
+ # by several processes at the same time,
+ # and bash >> is not atomic so
+ # some synchronization is needed to prevent corrupting the pid file
+ profiling_get_lock "${BC_PID_LOCK}"
+
+ {
+
+ bash -c 'echo -n "${PPID}"'
+ echo " = $@ \\n\\"
+
+ frame=0;
+ while caller "${frame}" &> /dev/null ; do
+ caller "${frame}" | {
+ read line subroutine file
+ echo "${file}: ${subroutine}(${line}) \\n\\"
+ }
+ frame=$((${frame} + 1))
+ done
+
+ echo
+
+ } >> "${BC_PID_LOG}"
+
+ profiling_release_lock "${BC_PID_LOCK}"
+ fi
+}
+
+profiling_start()
+{
+ einfo "Profiling init using bootchart"
+ /sbin/bootchartd init >/dev/null
+}