[m-rev.] for review: Delete MERCURY_OPTIONS -r option (repeats).
Peter Wang
novalazy at gmail.com
Thu Jul 13 12:55:08 AEST 2023
I always found the -r option questionable, but we can keep it if anyone
still wants it. Other options that I think should be removed:
-a benchmark_all_solns
-t use_own_timer (probably most useful with -r)
---
The MERCURY_OPTIONS -r option was an easy way to perform microbenchmarks
early on in the Mercury project, but arguably the time for that is past.
runtime/mercury_wrapper.c:
Delete code supporting the -r option.
scripts/mprof_merge_runs:
Delete mention of -r option.
tests/benchmarks/Mmakefile:
Delete/comment out rules that makes use of the -r option.
diff --git a/runtime/mercury_wrapper.c b/runtime/mercury_wrapper.c
index f3c0fb40c..91de654f2 100644
--- a/runtime/mercury_wrapper.c
+++ b/runtime/mercury_wrapper.c
@@ -291,7 +291,6 @@ char *MR_lld_print_more_min_max = NULL;
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
@@ -1407,7 +1406,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, "acC:d:D:e:i:m:n:o:pP:sStT:xX",
MR_long_opts, &long_index)) != EOF)
{
switch (c)
@@ -2247,13 +2246,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;
@@ -2428,8 +2420,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,38 +2475,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();
diff --git a/scripts/mprof_merge_runs b/scripts/mprof_merge_runs
index 33c54daa1..d33149474 100755
--- a/scripts/mprof_merge_runs
+++ b/scripts/mprof_merge_runs
@@ -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."
diff --git a/tests/benchmarks/Mmakefile b/tests/benchmarks/Mmakefile
index d62c2b0e8..6aff7e26a 100644
--- a/tests/benchmarks/Mmakefile
+++ b/tests/benchmarks/Mmakefile
@@ -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 $@
#-----------------------------------------------------------------------------#
--
2.39.0
More information about the reviews
mailing list