A simple harness for selecting and running benchmarks.
You can tailor whether or not you want results printed, or in lists.
(For a definitive benchmark, you wouldn't choose both).
Version 0.1
Code:
LOCAL ID:="Benchmarks V0.1 \n 2017 StephenG1CMZ";
//IMPORT REQUIRED BENCHMARKS
//IMPORT({MWIPS,SAVAGE);
EXPORT ABOUT()
BEGIN
MSGBOX(ID);
MSGBOX("A harness for benchmarks");
MSGBOX("Refer to individual benchmarks");
END;
//CUSTOMISE
//SELECT OUTPUT
//TO LIST OR TO SCREEN (OR LOGFILE TBD)
EXPORT BenchmarkList:=1;
EXPORT BenchmarkAns:={};
EXPORT BenchmarkPrint:=1;
//END CUSTOMISE
EXPORT OUTREAL(LST)
//REQUIRED TO OUTPUT OR USE RESULTS
//HOW IS UNSPECIFIED
BEGIN
//ONLY 1 OUTPUT IS REQUIRED
//THE SELECTION/ALTERNATIVE IS AN OVERHEAD ANDSHOULDBE REMOVED
IF BenchmarkPrint THEN
PRINT(LST);
END;
IF BenchmarkList THEN
BenchmarkAns(0):=LST;
END;
END;
EXPORT BenchmarkReset()
BEGIN
PRINT();
PRINT(ID);
BenchmarkAns:={};
END;
EXPORT ChooseBenchmark()
BEGIN
LOCAL CHS;
LOCAL BLST:={"","","Whetstone (MWIPS)","","Savage"};
WHILE CHOOSE(CHS,"Benchmarks (UNVERIFIED)",BLST) DO
CASE
IF CHS==3 THEN
BenchmarkPrint:=0;
//MWIPS();
DRAWMENU("","","","","","Esc");
WAIT();
END;
IF CHS==5 THEN
SAVAGE();
DRAWMENU("","","","","","Esc");
WAIT();
END;
DEFAULT
END;
END;
END;
EXPORT BENCHMARKS()
BEGIN
ABOUT();
ChooseBenchmark();
END;
Note: There is a complication in getting Whetstones and Benchmarks to compile.
Whetstones requires OUTREAL, so Benchmarks must be compiled first...
Except Benchmarks requires MWIPS so Whetstones must be compiled first.
The lazy solution:
1 Comment out MWIPS
2 Compile Benchmarks
3 Compile Whetstones
4 Uncomment MWIPS and re-compile Benchmarks.
*** I forgot Step 4 in Version 0.1 ***
An alternative method:(with MWIPS uncommented as intended)
1 write an empty OUTREAL
2 Compile Whetstones
3 Compile Benchmarks
4 Recompile whichever OUTREAL you wish to use.