Files
mercury/tools/extract_dd_stats
Ian MacLarty 468b4d4945 Include a script to test the performance of the debugger in the tools
Estimated hours taken: 4
Branches: main

Include a script to test the performance of the debugger in the tools
directory.

Add a --test dd command option.  The --test option causes the declarative
debugger to simulate a session where the user answers `no' to all questions
until a bug is found.

Remove the dd_dd mdb command and add a --debug option to the dd command which
does the same thing.  The double maintenance of the dd_dd and dd commands was
becoming onerous.

browser/declarative_debugger.m:
	Export a predicate to set the testing flag in the user state.

browser/declarative_oracle.m:
	Add a predicate to set the testing flag of the user state.

browser/declarative_user.m:
	Add a new flag to the user state which indicates whether user answers
	should be simulated.
	If the new flag is set then simulate answers instead of asking the
	user.

doc/user_guide.texi:
	Document the --test and --debug developer options.

tools/dd_speedtest:
	Script for testing the performance of the declarative debugger.

tools/extract_dd_stats.awk:
	Script for summarizing the output of dd_speedtest.

trace/mercury_trace_declarative.c:
	Add a predicate to set the testing flag of the diagnoser.
	Rename the global variable which says whether the declarative debugger
	is being debugged.
	Use the -p ps option to print the Memory consumption of the current
	process instead of using grep.

trace/mercury_trace_declarative.h:
	Fix a typo.
	Export the predicate to set the testing flag.
	Rename the global variable which says whether the declarative debugger
	is being debugged.

trace/mercury_trace_internal.c:
	Add the --test and --debug options and remove the dd_dd command.
2005-08-09 07:14:02 +00:00

130 lines
2.6 KiB
Bash
Executable File

#!/bin/sh
#---------------------------------------------------------------------------#
# Copyright (C) 2005 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
#
# This script summarizes the stats generated by the dd_speedtest script.
#
# It prints the options passed to the dd command followed by the following
# fields:
#
# reexec = number of reexecutions minus first and last reexecutions.
# nodes = number of nodes constructed in all reexecutions except first and
# last.
# ratio = nodes/reexec
# CPU = total CPU time from start of session to end of last reexecution.
# WC = total time from start of session to end of session.
# RSS = resident set size at end of last reexecution.
# VSZ = virtual size of process at end of last reexecution.
#
# To run this script do:
# extract_dd_stats dd.stats
#
awk '
BEGIN {
FS = " = "
printf("%6s %11s %10s %7s %7s %7s %7s\n", \
"reexec", "nodes", "ratio", "CPU", \
"WC", "RSS", "VSZ");
}
/^START / {
reset_per_run();
num_runs = 0;
total_time = 0;
total_wc_time = 0;
last_time = 0;
start = 1;
final = 0;
during = 0;
match($0, /START (.*)$/, a);
dd_opts = a[1];
printf("Options = %s\n", dd_opts);
}
/^DURING/ {
reset_per_run();
num_runs++;
if (start != 1) {
total_time += last_time;
}
start = 0;
final = 0;
during = 1;
last_time = 0;
}
/^FINAL/ {
reset_per_run();
total_time += last_time;
start = 0;
final = 1;
during = 0;
}
/^END$/ {
# discard the first and last re-execution.
reexec -= 2;
total_nodes = actual_nodes_for_run - nodes_in_first_reexecution \
- last_nodes_constructed_in_run;
if (out_of_memory == 1){
mem = "Out of Memory";
out_of_memory = 0;
} else {
mem = sprintf("%.1f", rss/1024);
}
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);
}
/Total CPU time/ {last_time = $2}
/Nodes constructed in this run/ {
if (start_of_run) {
nodes_in_first_reexecution = $2;
start_of_run = 0;
}
actual_nodes_for_run += $2
last_nodes_constructed_in_run = $2;
}
/Total reexecutions so far/ {
reexec = $2
}
/RSS =/ {
rss = $2
}
/VSZ =/ {
vsz = $2
}
/Out of Memory/ {
out_of_memory = 1;
}
/^STARTWCTIME/ {
start_wc_time = $2;
}
/^ENDWCTIME/ {
if (during == 1) {
total_wc_time += ($2 - start_wc_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;
}
' "$@"