[m-rev.] for review: dd_speedtest

Zoltan Somogyi zs at cs.mu.OZ.AU
Thu Aug 4 13:24:05 AEST 2005


On 03-Aug-2005, Ian MacLarty <maclarty at cs.mu.OZ.AU> wrote:
> -			help_system		:: help.system
> +			help_system		:: help.system,
> +
> +				% If this following flag is set to yes then
> +				% user responses will be simulated and will
> +				% always be `no', except when confirmining a
> +				% bug in which case the response will be `yes'.
> +			testing			:: bool
>  		).

s/confirmining/confirming/

> Index: doc/user_guide.texi
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
> retrieving revision 1.448
> diff -u -b -r1.448 user_guide.texi
> --- doc/user_guide.texi	1 Aug 2005 02:40:05 -0000	1.448
> +++ doc/user_guide.texi	2 Aug 2005 14:04:56 -0000
> @@ -3352,17 +3352,31 @@
>  @sp 1
>  @table @code
>  @item dd [-r] [-n at var{nodes}] [-s at var{search-mode}]
> - at c @item dd [--assume-all-io-is-tabled] [-d at var{depth}]
> + at c @item dd [--assume-all-io-is-tabled] [-d at var{depth}] [-t]
> + at c       [--debug [filename]]
>  @c The --assume-all-io-is-tabled option is for developers only. Specifying it
>  @c makes an assertion, and if the assertion is incorrect, the resulting
>  @c behaviour would be hard for non-developers to understand. The option is
>  @c therefore deliberately not documented.
> + at c @sp 1
>  @c The value of the @samp{-d} or @samp{--depth} option determines
>  @c how much of the annotated trace to build initially.  Subsequent runs
>  @c will try to add @var{nodes} events to the annotated trace, but initially
>  @c there is not enough information available to do this.  We do not document
>  @c this option since it requires an understanding of the internal workings of
>  @c the declarative debugger.
> + at c @sp 1
> + at c The @samp{-t} or @samp{--test} option causes the declarative debugger
> + at c to simulate a user who answers `no' to all questions, except for
> + at c `Is this a bug?' questions to which the simulated user answers `yes'.

You should add a sentence here about the intended use.

> + at c The @samp{--debug} option causes events generated by the declarative
> + at c debugger to become visible.  This allows the declarative debugger to be
> + at c debugged.
> + at c If a filename is provided, the front end of the debugger is not called
> + at c at all.  Instead a representation of the debugging tree is dumped to
> + at c the file.
> + at c @sp 1
>  Starts declarative debugging using the current event as the initial symptom.

> - at c If a filename is provided, the front end of the debugger is not called
> - at c at all.  Instead a representation of the debugging tree is dumped to
> - at c the file, which may help diagnose problems in the debugger itself.

Is there some reason why the second commented out sentence above is no longer
applicable?

> +# This script will append data to dd.stats and dd.stdout, so they should be
> +# deleted first if this behaviour is not desired.

In some of my benchmarking scripts, I handle this problem with code like this:

if test -f TIMES
then
	ci -l TIMES < /dev/null
	/bin/rm -f TIMES
fi

You could do the same for dd.stats and dd.stdout. You don't lose old info,
but there is no clutter either.

> +usage="Usage: dd_speedtest -c cmd [-n num_tests] [-d dd_options]"
> +cmd=""
> +limit=6
> +ddopts="-s divide_and_query -n 50000 -d 1"
> +
> +while test $# -gt 0
> +do
> +	case $1 in
> +
> +	-c|--cmd)
> +		cmd="$2" ; shift ;;
> +
> +	-d|--ddopts)
> +		ddopts="$2" ; shift ;;
> +
> +	-n)
> +		limit="$2" ; shift ;;
> +
> +	-*)
> +		echo "$0: unknown option \`$1'" 2>&1
> +		echo $usage
> +		exit 1 ;;
> +
> +	*)	break ;;
> +	esac
> +	shift
> +done

This should probably use getopts. See slide set 1 in the 252 lecture notes.

> Index: tools/extract_dd_stats.awk
> ===================================================================
> RCS file: tools/extract_dd_stats.awk
> diff -N tools/extract_dd_stats.awk
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ tools/extract_dd_stats.awk	3 Aug 2005 13:04:07 -0000
...
> @@ -0,0 +1,126 @@
> +#
> +# To run this script do:
> +# awk -f extract_dd_stats.awk dd.stats

Instead of this, make a file called extract_dd_stats containing

	#/bin/sh
	awk '
	THE CONTENTS OF extract_dd_stats.awk
	with any 's escaped by a backslash
	and with that comment about invocation modified, of course
	' "$@"

since that is easier to invoke.

> +
> +BEGIN {
> +	FS = " = "
> +	printf("%6s %11s %10s %7s %7s %7s %7s\n", \
> +		"reexec", "nodes", "ratio", "CPU", \
> +		"WC", "RSS", "VSZ");
> +}
...
> +	printf("%6i %11i %10d %7.1f %7.1f %7s %7.1f\n", \
> +		reexec, \
> +		total_nodes, total_nodes/reexec, \
> +		total_time/num_runs, total_wc_time/num_runs, \
> +		mem, vsz/1024);
> +}

With a shell script, you can have an option that, if set, causes the
information printed in these places to be printed with latex column separators
ready for inclusion in the paper, but we probably don't need that anymore;
but add this to your bag of tricks for next time.

> +function reset_per_run() {
> +	actual_nodes_for_run = 0;
> +	nodes_in_first_reexecution = 0;
> +	start_of_run = 1;
> +	last_nodes_constructed_in_run = 0;
> +}

I don't know whether all the versions of awk on our system support functions,
but if not, that can be fixed later.

> @@ -2396,8 +2406,8 @@
>      fprintf(stderr, "Total CPU time = %.2f\n",
>          MR_get_user_cpu_miliseconds() / 1000.0);
>      pid = getpid();
> -    sprintf(cmdstr, "ps -o pid,rss | grep %i | awk '{print $2}' 1>&2", pid);
> -    fprintf(stderr, "RSS = ");
> +    sprintf(cmdstr, "ps -hp %i -o rss,vsz | "
> +    	"awk '{print \"RSS = \" $1 \"\\nVSZ = \" $2}' 1>&2", pid);
>      system(cmdstr);

The old code here worked on aral, but the new one doesn't. Neither the old
nor the new code works on mundula (Solaris).

Otherwise, that is fine.

Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list