bprof r11 - in trunk: . mempattern mempattern/contrib



Author: stefkost
Date: Wed May 14 07:30:32 2008
New Revision: 11
URL: http://svn.gnome.org/viewvc/bprof?rev=11&view=rev

Log:
	* mempattern/contrib
	* mempattern/contrib/run-with-mempattern:
	* mempattern/contrib/run-with-mempattern.1:
	  Add wrapper script to launch apps.
	* mempattern/mempattern-plot:
	* mempattern/mempattern-plot.1:
	* mempattern/mpplot.gp:
	  Rename and add basic man page.



Added:
   trunk/mempattern/contrib/
   trunk/mempattern/contrib/run-with-mempattern
   trunk/mempattern/contrib/run-with-mempattern.1
   trunk/mempattern/mempattern-plot
      - copied, changed from r9, /trunk/mempattern/mpplot.gp
   trunk/mempattern/mempattern-plot.1
Removed:
   trunk/mempattern/mpplot.gp
Modified:
   trunk/ChangeLog

Added: trunk/mempattern/contrib/run-with-mempattern
==============================================================================
--- (empty file)
+++ trunk/mempattern/contrib/run-with-mempattern	Wed May 14 07:30:32 2008
@@ -0,0 +1,87 @@
+#!/bin/sh
+#
+# Helper script for using libmempattern on binaries in Scratchbox,
+# includes stuff from run-standalone.sh.  This file is part of
+# mempattern.
+#
+# Copyright (C) 2008 Nokia Corporation. 
+#
+# Contact: Eero Tamminen <eero tamminen nokia com>
+#
+# This library wrapper is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# version 2.1 as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+# 
+# There are several ways to use this script
+# - Rename the original binary to <name>.real and
+#   put/link this script in place of the original binary
+# - If the binary is using "maemo-launcher", this can
+#   be linked instead of the "maemo-invoker" and it will
+#   automatically call "launcher-wrapper"
+# - Call the binary with this script, e.g. like this
+#   export PROFILE_START=y
+#   DISPLAY=:1 run-standalone.sh run-with-libmempattern <binary> <arguments>
+# 
+# This sets all the required environment variables etc.
+# before calling libmempattern.
+
+wrapper=/usr/bin/maemo-summoner
+
+if [ -x "$0.real" ]; then
+	app="$0.real"
+elif [ -x "$1.launch" ] || [ -x "$0.launch" ] || [ "${1##*.}" = "launch" ]; then
+	# use launcher wrapper automatically if given binary that needs it
+	if [ \! -x "$wrapper" ]; then
+		echo "ERROR: '$wrapper' for running .launch binaries is missing!"
+		exit 1
+	fi
+	echo "$0: $*"
+	if [ -x "$1.launch" ]; then
+		app="$wrapper $1.launch"
+		shift
+        elif [ -x "$0.launch" ]; then
+		app="$wrapper $0.launch"
+	else
+		app="$wrapper $1"
+		shift
+	fi
+	echo "$0: $*"
+elif [ -x "$1" ]; then
+	app="$1"
+	shift
+else
+	echo "ERROR: no application given!"
+	exit 1
+fi
+app_opts="$*"
+
+# funny things happen if library set to /etc/ld.so.preload is missing...
+libmempattern=/usr/lib/libmempattern.so
+if [ \! -f $libmempattern ]; then
+	echo "ERROR: $libmempattern missing!"
+	exit 1
+fi
+
+# LD_PRELOAD doesn't work in Scratchbox
+if [ -f /targets/links/scratchbox.config ]; then
+	echo "Using /etc/ld.so.preload for overriding functions in $app with libmempattern"
+	echo $libmempattern > /etc/ld.so.preload
+	$app $app_opts
+	rm /etc/ld.so.preload
+else
+	echo "Using LD_PRELOAD for overriding functions in $app with libmempattern"
+	export LD_PRELOAD=$LD_PRELOAD:$libmempattern
+	$app $app_opts
+fi
+
+

Added: trunk/mempattern/contrib/run-with-mempattern.1
==============================================================================
--- (empty file)
+++ trunk/mempattern/contrib/run-with-mempattern.1	Wed May 14 07:30:32 2008
@@ -0,0 +1,68 @@
+.TH RUN-WITH-LIBMEMPATTERN 1 "2008-03-27" "libmempattern"
+.SH NAME
+run-with-libmempattern - run applications under libmempattern
+.SH SYNOPSIS
+run-with-libmempattern \fIbinary\fP \fIarguments\fP
+.SH DESCRIPTION
+\fIrun-with-libmempattern\fP is a helper script for the libmempattern
+glib memory allocation wrapper library. The script runs given binary
+(with its arguments) under libmempattern using suitable options 
+for the Maemo environment.  For example maemo-launched applications are
+run with \fImaemo-summoner\fP.
+.PP
+Normally script uses just LD_PRELOAD to run the application under
+libmempattern, but that doesn't work with Scratchbox. Inside Scratchbox
+the script needs to temporarily modify /etc/ld.so.preload file instead
+when starting the application.
+.PP
+The produced libmempattern reports can be post-processed e.g. with the provided mpplot.gp Gnuplot wrapper script (should be run on desktop) to make more intuitive visualizations.
+.SH EXAMPLES
+There are a few ways to use this script:
+.PP
+\(bu If the binary is using "maemo-launcher", this script can be linked
+to the binary name instead of the "maemo-invoker" and the script will
+automatically call "maemo-summoner" as needed.
+.PP
+\(bu Call the binary directly with this script, e.g. like this:
+.br
+.B	DISPLAY=:1 run-standalone.sh run-with-libmempattern <binary> <arguments> 
+.PP
+\(bu Rename the original binary to <name>.real and put/link this
+script in place of the original binary.
+.br
+.PP Some environmental variables can also be set before calling the script to tweak the behavior of libmempattern. They are supported by libmempattern itself, so they can also be used without the helper script. The following variables are supported:
+.br
+.TP
+.B MP_TRACE_SIZE
+.br
+When the value of this variable matches the size of memory allocated by the current allocation operation, a backtrace will be generated and logged.
+.B MP_TRACE_INTERACTIVE
+.br
+Only effective when used with MP_TRACE_SIZE. Determines whether memory allocations matching the MP_TRACE_SIZE criteria causes libmempattern to allow user to choose how to respond. This is enabled by default (value of 0 disables it, all other values enable it).
+.B MP_LOG_START
+.br
+Initial delay (in seconds) before the allocation logging is started, defaults to 0. MP_LOG_START=0.5 skips allocations done during the first half of a second after the process is invoked.
+.B MP_USAGE_SCALE
+.br
+Sets the scaling for allocated and usable memory size data, defaults to 1. MP_USAGE_SCALE=1024 would log usage statistics as kilobytes instead of bytes. 
+.SH FILES
+.br
+.B	/etc/ld.so.preload
+.br
+.B	/tmp/mp_bt.log
+.br
+.B	/tmp/mp_frag.log
+.br
+.B	/tmp/mp_time.log
+.br
+.B	/tmp/mp_use.log
+.SH SEE ALSO
+.IR maemo-summoner (1)
+.SH COPYRIGHT
+Copyright (C) 2008 Nokia Corporation.
+.PP
+This is free software.  You may redistribute copies of it under the
+terms of the GNU Library General Public License v2 included with the software.
+There is NO WARRANTY, to the extent permitted by law.
+
+

Copied: trunk/mempattern/mempattern-plot (from r9, /trunk/mempattern/mpplot.gp)
==============================================================================
--- /trunk/mempattern/mpplot.gp	(original)
+++ trunk/mempattern/mempattern-plot	Wed May 14 07:30:32 2008
@@ -1,11 +1,12 @@
-#!/bin/bash
-# mpplot.gp <basename> <title>
+#!/bin/sh
+# mempattern-plot <basename> <title>
 #
 
 if [ -z "$1" ]; then
   title="Memory usage patterns"
 else
-  title="${1//_/ }"
+  #title="${1//_/ }"
+  title=`echo $1 | tr "_" " "`
 fi
 
 gnuplot << EOF

Added: trunk/mempattern/mempattern-plot.1
==============================================================================
--- (empty file)
+++ trunk/mempattern/mempattern-plot.1	Wed May 14 07:30:32 2008
@@ -0,0 +1,22 @@
+.TH MEMPATTERN-PLOT 1 "2008-05-14" "libmempattern"
+.SH NAME
+mempattern-plot - plot libmempattern trace results using gnuplot
+.SH SYNOPSIS
+mempattern-plot \fIbasename\fP \fItitle\fP
+.SH DESCRIPTION
+\fImempattern-plot\fP is a helper script to render libmempattern trace results.
+It outputs both \fIbasename\fP.png and \fIbasename\fP.ps.
+.SH FILES
+.br
+.B	/tmp/mp_time.log
+.br
+.B	/tmp/mp_use.log
+
+.SH COPYRIGHT
+Copyright (C) 2008 Nokia Corporation.
+.PP
+This is free software.  You may redistribute copies of it under the
+terms of the GNU Library General Public License v2 included with the software.
+There is NO WARRANTY, to the extent permitted by law.
+
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]