[m-rev.] for review: add mdb `dice' command

Julien Fischer juliensf at cs.mu.OZ.AU
Mon Feb 7 16:06:41 AEDT 2005



On Sun, 6 Feb 2005, Ian MacLarty wrote:

> +A dice is a comparison between some successful test runs of the program and a
> +failing test run.  Before using the @samp{dice} command one or more passing
> +execution summaries and one failing execution summary should be generated.
s/should be/need to be/

> +This can be done by compiling the program with deep tracing enabled (either by
> +compiling in the .debug or .decldebug grades or with the @samp{--trace deep}
> +compiler option) and then running the program with the MERCURY_OPTIONS
> +environment variable set to @samp{--trace-count}.
> +This will generate a file called
> + at samp{.mercury_trace_counts} which contains a summary of the program's execution
> +(called a slice).
I suggest making that aside an actual sentence. e.g.

	This summary is called a slice.
...

> +NEGE, NEGS and NEGF events where the goal path and port is displayed.
s/is/are/

The whole discussion below would be improved if you included an example
of a program dice.

> + at item @samp{File:Line}:
> +The file name and line number of the goal.  This can be used to set a
> +breakpoint on the goal.
> + at item @samp{Pass (total passing test runs)}:
> +The total number of times the goal was executed in all the passing test runs.
> +This is followed by a number in braces which indicates the number of test runs
> +the goal was executed in.  The heading of this column also has a number in
> +braces which is the total number of passing test cases.
> + at item @samp{Fail}:
> +The number of times the goal was executed in the failing test run.
> + at item @samp{Suspicion}:
> +A number between 0 and 1 which gives an indication of how lightly a
s/lightly/likely/

> +particular goal is to be buggy.  The is calculated as
> +Suspicion = F / (P + F) where F is the number of times the goal
> +was executed in the failing test run and P is the number of times the goal
> +was executed in passing test runs.
> + at end itemize
> + at sp 1
> +The name of the file containing the failing slice can be specified with the
> + at samp{-f} or @samp{--fail-trace-count} option or with a seperate
s/seperate/separate/

> + at samp{set fail_trace_count @var{filename}} command.
> + at sp 1
> +The name of a file containing a list of the files containing the passing
> +slices can be given with the @samp{-p} or @samp{--pass-trace-counts} option.
> +Alternatively a seperate @samp{set pass_trace_counts @var{filename}} command
s/seperate/separate/

> +can be given.
> + at sp 1
> +The table can be sorted on the Pass, Fail or Suspicion columns, or a
> +combination of these.  This can be done with the @samp{-s} or @samp{--sort}
> +option.  The argument of this option is a string made up of any combination of
> +the letters @samp{pPfFsS}.  The letters in the string indicate how the table
> +should be sorted:
> + at sp 1
> + at itemize @bullet
> + at item @samp{p}: Pass ascending
> + at item @samp{P}: Pass descending
> + at item @samp{f}: Fail ascending
> + at item @samp{F}: Fail descending
> + at item @samp{s}: Suspicion ascending
> + at item @samp{S}: Suspicion descending
> + at end itemize
> + at sp 1
> +For example the string "SF" means sort the table by suspicion, descending, and
> +if any two suspicions are the same, then by number of executions in the failing
> +test case, descending.
> + at sp 1
> +The option @samp{-n} or @samp{--top} can be used to limit the number lines
> +displayed.  Only the top @var{num} lines, with respect to
> +the ordering specified by the @samp{-s} option, will be displayed.
> +By default the table is limited to 50 lines.
> + at sp 1
> +If the @samp{-o} or @samp{--output-to-file} option is given then the output
> +will be written to the specified file instead of being displayed on the
> +screen.  Note that the file will be overwritten without warning if it
> +already exists.
>  @end table
>
...

> @@ -2357,7 +2406,7 @@
>              flat_format, raw_pretty_format, verbose_format, pretty_format,
>              words[1], words[2]))
>      {
> -        MR_trace_usage("parameter", "set");
> +        MR_trace_usage("misc", "set");
>      }
>
>      return KEEP_INTERACTING;
> @@ -5830,6 +5879,100 @@
>      return KEEP_INTERACTING;
>  }
>
> +static MR_Next
> +MR_trace_cmd_dice(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
> +    MR_Event_Info *event_info, MR_Event_Details *event_details,
> +    MR_Code **jumpaddr)
> +{
> +    char    *pass_trace_counts_file;
> +    char    *fail_trace_count_file;
> +    char    *sort_str = (char*)malloc(MR_MAX_DICE_SORT_STR_SIZE + 1);
> +    char    *out_file = NULL;
> +    int     n = 50;

`n' is not a meaningful variable name.  I suggest `number_of_lines'
or something like that.  If you're going to have that magic number
there I suggest at least a comment about what it is.  Better still,
make it a symbolic constant.

> +
> +    pass_trace_counts_file = MR_dice_pass_trace_counts_file;
> +    fail_trace_count_file = MR_dice_fail_trace_count_file;
> +    strcpy(sort_str, "");
> +
> +    if (! MR_trace_options_dice(&pass_trace_counts_file,
> +        &fail_trace_count_file, &sort_str, &n, &out_file, &words, &word_count,
> +        "exp", "dice"))
> +    {
> +        ; /* the usage message has already been printed */
> +    } else if (word_count == 1) {
> +        if (pass_trace_counts_file == NULL) {
> +            fflush(MR_mdb_out);
> +            fprintf(MR_mdb_err, "mdb: No passing trace counts file specified."
> +                "\nmdb: Specify one with the -p option or using the `set' "
> +                "command.\n");
> +        } else if (fail_trace_count_file == NULL) {
> +            fflush(MR_mdb_out);
> +            fprintf(MR_mdb_err, "mdb: No failing trace count file specified."
> +                "\nmdb: Specify one with the -f option or using the `set' "
> +                "command.\n");
> +        } else {
> +            MR_trace_print_dice(pass_trace_counts_file, fail_trace_count_file,
> +                sort_str, n, out_file);
> +        }
> +    } else {
> +        MR_trace_usage("exp", "dice");
> +    }
> +
> +    free(out_file);
> +    free(sort_str);
> +
> +    return KEEP_INTERACTING;
> +}

Cheers,
Julien.
--------------------------------------------------------------------------
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