Delete MERCURY_OPTIONS -a -r -t options.

The MERCURY_OPTIONS environment variable supported these options

    -a  benchmark_all_solns
    -r  repeats
    -t  use_own_timer

to perform microbenchmarks very early on in the Mercury project,
but the time for that is past.

runtime/mercury_wrapper.c:
    Delete code supporting -a, -r and -t options.

scripts/mprof_merge_runs:
    Delete mention of -r option.

tests/benchmarks/Mmakefile:
    Delete/comment out rules that makes use of the -r option.
This commit is contained in:
Peter Wang
2023-07-14 10:59:51 +10:00
parent 9cfc90a6a4
commit adb22a74a7
3 changed files with 19 additions and 79 deletions

View File

@@ -289,9 +289,6 @@ char *MR_lld_print_more_min_max = NULL;
// other options
MR_bool MR_check_space = MR_FALSE;
static MR_bool benchmark_all_solns = MR_FALSE;
static MR_bool use_own_timer = MR_FALSE;
static int repeats = 1;
#define MAX_MEM_USAGE_REPORT_ATTEMPTS 100
@@ -312,7 +309,6 @@ static MR_bool MR_print_table_statistics = MR_FALSE;
// Timing.
int MR_user_time_at_last_stat;
int MR_user_time_at_start;
static int MR_user_time_at_finish;
int MR_real_time_at_last_stat;
int MR_real_time_at_start;
@@ -1407,7 +1403,7 @@ MR_process_options(int argc, char **argv)
int c;
int long_index;
while ((c = MR_getopt_long(argc, argv, "acC:d:D:e:i:m:n:o:pP:r:sStT:xX",
while ((c = MR_getopt_long(argc, argv, "cC:d:D:e:i:m:n:o:pP:sST:xX",
MR_long_opts, &long_index)) != EOF)
{
switch (c)
@@ -2082,10 +2078,6 @@ MR_process_options(int argc, char **argv)
#endif
break;
case 'a':
benchmark_all_solns = MR_TRUE;
break;
case 'c':
MR_check_space = MR_TRUE;
break;
@@ -2207,8 +2199,6 @@ MR_process_options(int argc, char **argv)
} else {
MR_usage();
}
use_own_timer = MR_FALSE;
break;
case 'D':
@@ -2247,13 +2237,6 @@ MR_process_options(int argc, char **argv)
#endif
break;
case 'r':
if (sscanf(MR_optarg, "%d", &repeats) != 1) {
MR_usage();
}
break;
case 's':
MR_deep_profiling_save_results = MR_FALSE;
MR_complexity_save_results = MR_FALSE;
@@ -2263,18 +2246,6 @@ MR_process_options(int argc, char **argv)
MR_print_deep_profiling_statistics = MR_TRUE;
break;
case 't':
use_own_timer = MR_TRUE;
MR_calldebug = MR_FALSE;
MR_nondetstackdebug = MR_FALSE;
MR_detstackdebug = MR_FALSE;
MR_heapdebug = MR_FALSE;
MR_gotodebug = MR_FALSE;
MR_sregdebug = MR_FALSE;
MR_finaldebug = MR_FALSE;
break;
case 'T':
if (MR_streq(MR_optarg, "r")) {
MR_time_profile_method = MR_profile_real_time;
@@ -2428,8 +2399,6 @@ mercury_runtime_main(void)
MR_CallSiteDynamic *saved_cur_csd;
#endif
static int repcounter;
#ifdef MR_MSVC_STRUCTURED_EXCEPTIONS
// Under Win32 we use the following construction to handle exceptions.
// __try
@@ -2485,42 +2454,32 @@ mercury_runtime_main(void)
MR_real_time_at_start = MR_get_real_milliseconds();
MR_real_time_at_last_stat = MR_real_time_at_start;
for (repcounter = 0; repcounter < repeats; repcounter++) {
#ifdef MR_DEEP_PROFILING
saved_cur_callback = MR_current_callback_site;
saved_cur_csd = MR_current_call_site_dynamic;
MR_setup_callback(MR_program_entry_point);
saved_cur_callback = MR_current_callback_site;
saved_cur_csd = MR_current_call_site_dynamic;
MR_setup_callback(MR_program_entry_point);
#endif
#ifdef MR_THREADSCOPE
MR_threadscope_post_calling_main();
MR_threadscope_post_calling_main();
#endif
#ifdef MR_HIGHLEVEL_CODE
MR_do_interpreter();
MR_do_interpreter();
#else
MR_debugmsg0("About to call engine\n");
(void) MR_call_engine(MR_ENTRY(MR_do_interpreter), MR_FALSE);
MR_debugmsg0("Returning from MR_call_engine()\n");
MR_debugmsg0("About to call engine\n");
(void) MR_call_engine(MR_ENTRY(MR_do_interpreter), MR_FALSE);
MR_debugmsg0("Returning from MR_call_engine()\n");
#endif
#ifdef MR_THREADSCOPE
MR_threadscope_post_stop_context(MR_TS_STOP_REASON_FINISHED);
MR_threadscope_post_stop_context(MR_TS_STOP_REASON_FINISHED);
#endif
#ifdef MR_DEEP_PROFILING
MR_current_call_site_dynamic = saved_cur_csd;
MR_current_callback_site = saved_cur_callback;
MR_current_call_site_dynamic = saved_cur_csd;
MR_current_callback_site = saved_cur_callback;
#endif
}
if (use_own_timer) {
MR_user_time_at_finish = MR_get_user_cpu_milliseconds();
}
#if defined(MR_USE_GCC_NONLOCAL_GOTOS) && defined(MR_DEBUG_THE_RUNTIME)
{
@@ -2574,12 +2533,6 @@ mercury_runtime_main(void)
}
#endif
if (use_own_timer) {
printf("%8.3fu ",
((double) (MR_user_time_at_finish - MR_user_time_at_start))
/ 1000);
}
#ifdef MR_TYPE_CTOR_STATS
MR_print_type_ctor_stats();
#endif
@@ -2882,11 +2835,7 @@ MR_define_label(global_success_2);
}
#endif
if (benchmark_all_solns) {
MR_redo();
} else {
MR_GOTO_LABEL(all_done);
}
MR_GOTO_LABEL(all_done);
MR_define_label(global_fail);
#ifdef MR_DEBUG_THE_RUNTIME

View File

@@ -36,14 +36,6 @@ Usage:
mprof -c | more
Note: If you just want to run your program N times with
the same arguments, a simpler way of achieving this
is to instead use the \`-r<N>' (\"repeat N times\")
option to the Mercury runtime, which you can pass by
setting the environment variable MERCURY_OPTIONS, e.g.
env MERCURY_OPTIONS=-r100 ./my_program
Options:
-h, --help
Print this help message."

View File

@@ -40,20 +40,19 @@ include Mercury.options
%.runtest: %.res ;
CS = $(PROGS:%=%.c)
TIMES = $(PROGS:%=%.time)
cs: $(CS)
times: $(TIMES)
dir.%: $(PROGS)
-mkdir $@
cp $(PROGS) $@
cp BenchEntry $@
%.time: %
{ count=`awk '/$*/ { print $$2; exit; }' < BenchRepeatCounts`; \
echo "$$count "; \
MERCURY_OPTIONS="-t -r$$count" ./repeat_time 3 ./$*; } 2>&1 | tee $@
# The MERCURY_OPTIONS -r option was removed so if you want to time these
# programs you will need to modify them to use the benchmarking module.
#%.time: %
# { count=`awk '/$*/ { print $$2; exit; }' < BenchRepeatCounts`; \
# echo "$$count "; \
# MERCURY_OPTIONS="-t -r$$count" ./repeat_time 3 ./$*; } 2>&1 | tee $@
#-----------------------------------------------------------------------------#