-/* --- @BENCH_MEASURE_DECLS@ --- *
- *
- * Arguments: ---
- *
- * Use: Expands to the declarations needed by @BENCH_MEASURE@.
- * These should be at block scope, not at toplevel.
- */
-
-#define BENCH_MEASURE_DECLS \
- struct bench_state *_bench_b; \
- struct bench_timing *_bench_t; \
- double _bench_nn; \
- BENCH_TIMELOOP_DECLS
-
-/* --- @BENCH_MEASURE@, @BENCH_MEASURE_TAG@ --- *
- *
- * Arguments: @tag@ = control structure tag
- * @struct bench_state *b@ = benchmark state
- * @int &rc@ = where to put the result code (zero on success,
- * %$-1$% on failure)
- * @struct bench_timing *t_out@ = where to put the result
- * @double base@ = number of operations per external iteration
- *
- * Returns: ---
- *
- * Use: @BENCH_MEASURE(b, rc, delta_out, n) stmt@ measures the
- * execution of @stmt@.
- *
- * The statement should perform @_bench_n@ iterations of some
- * operation. It will be invoked multiple times, with varying
- * iteration counts, so as to run for approximately
- * @b->target_s@ seconds.
- *
- * On success, the resulting timing is left in @*t_out@, with
- * @t_out->n@ holding the product of the final iteration count
- * and @base@, and @rc@ is set to zero. If the timer fails, or
- * if @stmt@ invokes a free @break@ statement, then @rc@ is set
- * to %$-1$%.
- *
- * The macro @BENCH_MEASURE_TAG@ is the same, except that it
- * allows an explicit control-structure tag to be set so that it
- * can be used within larger control structure macros.
- */
-
-#define BENCH_MEASURE_TAG(tag, b, rc, t_out, base) \
- MC_BEFORE(tag##__benchmsr_setup, { \
- _bench_b = (b); _bench_t = (t_out); _bench_nn = 1.0; \
- if (bench_preflight(_bench_b)) MC_GOTARGET(tag##__benchmsr_fail); \
- }) \
- MC_TARGET(tag##__benchmsr_done, \
- { bench_adjust(_bench_b, _bench_t, _bench_nn, (base)); (rc) = 0; }) \
- MC_TARGET(tag##__benchmsr_fail, { (rc) = -1; }) \
- for (;;) \
- MC_WRAP(tag##__benchmsr_loop, \
- { ; }, \
- { _bench_t->f &= _bench_b->f; \
- if (!(_bench_t->f&BTF_TIMEOK)) MC_GOTARGET(tag##__benchmsr_fail); \
- if (bench_adapt(_bench_b, &_bench_nn, _bench_t)) \
- MC_GOTARGET(tag##__benchmsr_done); \
- }, \
- { MC_GOTARGET(tag##__benchmsr_fail); }) \
- BENCH_TIMELOOP_TAG(tag##__benchmsr_time, _bench_b, _bench_t, _bench_nn)
-
-#define BENCH_MEASURE(b, rc, t_out, base) \
- BENCH_MEASURE_TAG(bench_measure, b, rc, t_out, base)
-
-/* --- @BENCHMARK_DECLS@ --- *
- *
- * Arguments: ---
- *
- * Use: Expands to the declarations needed by @BENCHMARK_TAG@.
- * These should be at block scope, not at toplevel.
- */
-
-#define BENCHMARK_DECLS \
- struct bench_timing _bench_tm; \
- int _bench_rc; \
- BENCH_MEASURE_DECLS
-
-/* --- @BENCHMARK_TAG@ --- *
- *
- * Arguments: @tag@ = control structure tag
- * @struct bench_state *b@ = benchmark state
- * @struct gprintf_ops *gops, void *go@ = output formatter
- * @unsigned unit@ = unit being measured (@BTU_...@ code)
- * @double base@ = number of units per external iteration
- *
- * Returns: ---
- *
- * Use: @BENCHMARK_TAG(tag, b, gops, go, unit, base) stmt@ measures
- * the execution of @stmt@ and writes a report to an output
- * formatter. The @stmt@ should run @_bench_n@ iterations of
- * the operation to be measured.
- *
- * No tagless version of this macro is provided, because it is
- * expected to be useful primarily in the construction of
- * higher-level macros.
- */
-
-#define BENCHMARK_TAG(tag, b, gops, go, unit, base) \
- MC_AFTER(tag##__benchmark_after, { \
- if (_bench_rc) gprintf((gops), (go), "FAILED"); \
- else bench_report((gops), (go), _bench_b, (unit), &_bench_tm); \
- }) \
- BENCH_MEASURE_TAG(tag##__benchmark_measure, \
- (b), _bench_rc, &_bench_tm, (base))
-
-/*----- Functions provided ------------------------------------------------*/