Calibrator has a separate license that must be accepted by the user which is why the tool requires that it be downloaded. This patch provides the option of the tool being automatically downloaded and built for the user. As part of that, the software license is displayed so it can be optionally accepted or rejected.
Signed-off-by: Mel Gorman <m...@csn.ul.ie> --- tlbmiss_cost.sh | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 46 insertions(+), 1 deletions(-) diff --git a/tlbmiss_cost.sh b/tlbmiss_cost.sh index 3e4b260..dbdd023 100755 --- a/tlbmiss_cost.sh +++ b/tlbmiss_cost.sh @@ -42,6 +42,50 @@ die() exit -1 } +calibrator_fetch() +{ + if [ "`which calibrator`" != "" -o -e ./calibrator ]; then + echo Calibrator is already in path or in current directory + return + fi + + TMPFILE=`mktemp`.c + if [ "$TMPFILE" = "" ]; then + die Failed to create tmpfile + fi + trap "rm $TMPFILE; exit" INT + + WGET=`which wget 2> /dev/null` + if [ "$WGET" = "" ]; then + rm $TMPFILE + die wget is not installed, cannot fetch calibrator.c + fi + + wget http://homepages.cwi.nl/~manegold/Calibrator/v0.9e/calibrator.c -O $TMPFILE || die Failed to download calibrator.c + + LICENSE_END=`grep -n "^ \*/" $TMPFILE | head -1 | cut -f1 -d:` + echo Displaying calibrator license + head -$LICENSE_END $TMPFILE + echo + echo Calibrator is an external tool used by tlbmiss_cost.sh. The license + echo for this software is displayed above. Are you willing to accept the + echo -n "terms of this license [Y/N]? " + read INPUT + + if [ "$INPUT" != "Y" -a "$INPUT" != "y" ]; then + rm $TMPFILE + echo Bailing... + return + fi + echo Building... + gcc $TMPFILE -w -lm -o calibrator || die Failed to compile calibrator + echo Calibrator available at ./calibrator. For future use, run tlbmiss_cost.sh + echo from current directory or copy calibrator into your PATH + echo + + rm $TMPFILE +} + calibrator_calc() { if [ "$CALIBRATOR" = "" ]; then @@ -199,7 +243,7 @@ oprofile_calc() LAST_LATENCY_CYCLES=$(($TABLE_WALK/$TLB_MISS)) } -ARGS=`getopt -o c:s:vq --long calibrator:,stream:,verbose,quiet -n 'tlbmiss_cost.sh' -- "$@"` +ARGS=`getopt -o c:s:vq --long calibrator:,stream:,verbose,quiet,fetch-calibrator -n 'tlbmiss_cost.sh' -- "$@"` eval set -- "$ARGS" @@ -209,6 +253,7 @@ while true ; do -s|--stream) STREAM="$2" ; shift 2 ;; -v|--verbose) VERBOSE=$(($VERBOSE+1)); shift;; -q|--quiet) VERBOSE=$(($VERBOSE-1)); shift;; + --fetch-calibrator) calibrator_fetch; shift;; "") shift ; break ;; "--") shift ; break ;; *) die "Unrecognized option $1" ;; -- 1.6.3.3 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Libhugetlbfs-devel mailing list Libhugetlbfs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel