#!/bin/sh

if [ ! -e "xxxnytprofhtml" ]
then
	echo "Devel::NYTProf is NOT installed"
	echo "------------ ERROR ---------------------------------------------------"
	exit 1
fi

DEBUG=
LOCK_TEST=
MAKE_MUTABLE=
NO_DIE_WARN=
PATH='500_speed/201_buxxxrial_profile.t'
SPEED_TEST=1
TEST_PATH='../t'
VERBOSE=

while getopts 't:' OPTION
do
	case "$OPTION" in

	t)		TEST_PATH="$OPTARG";;

	esac
done

echo "#"
echo "# frostprof..."
echo "#"
echo "------------ PARAM ---------------------------------------------------"
echo "VERBOSE      = $VERBOSE"
echo "DEBUG        = $DEBUG"
echo "MAKE_MUTABLE = $MAKE_MUTABLE"
echo "LOCK_TEST    = $LOCK_TEST"
echo "SPEED_TEST   = $SPEED_TEST"
echo "NO_DIE_WARN  = $NO_DIE_WARN"
echo "TEST_PATH    = $TEST_PATH"
echo "PATH         = $PATH"
echo "------------ TEST ----------------------------------------------------"

if [ ! -e "$TEST_PATH/$PATH" ]
then
	echo "Profile test $PATH not found in $TEST_PATH"
	echo "------------ ERROR ---------------------------------------------------"
	exit 1
fi

export Frost_NO_DIE_ON_WARNINGS=$NO_DIE_WARN
export Frost_DEBUG=$DEBUG
export Frost_MAKE_MUTABLE=$MAKE_MUTABLE
export Frost_LOCK=$LOCK_TEST
export Frost_SPEED=$SPEED_TEST

cd $TEST_PATH

perl -d:NYTProf -I../lib $PATH

echo "----------------------------------------------------------------------"
echo "Creating HTML pages..."

nytprofhtml


echo "------------ DONE ----------------------------------------------------"
