5 * (c) 2023 Straylight/Edgeware
8 /*----- Licensing notice --------------------------------------------------*
10 * This file is part of the mLib utilities library.
12 * mLib is free software: you can redistribute it and/or modify it under
13 * the terms of the GNU Library General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or (at
15 * your option) any later version.
17 * mLib is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
20 * License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with mLib. If not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
35 /*----- Header files ------------------------------------------------------*/
41 /*----- Data structures ---------------------------------------------------*/
47 #define BTF_ANY (BTF_TIMEOK | BTF_CYOK)
48 kludge64 s; uint32 ns;
58 struct bench_timer { const struct bench_timerops *ops; };
60 struct bench_timerops {
61 void (*now)(struct bench_timer */*bt*/, struct bench_time */*t_out*/);
62 void (*destroy)(struct bench_timer */*bt*/);
66 struct bench_timer *tm;
69 struct { double m, c; } clk, cy;
72 typedef void bench_fn(unsigned long /*n*/, void */*p*/);
74 /*----- Functions provided ------------------------------------------------*/
76 extern struct bench_timer *bench_createtimer(void);
78 extern void bench_init(struct bench_state *b, struct bench_timer *tm);
80 extern void bench_destroy(struct bench_state *b);
82 extern int bench_calibrate(struct bench_state */*b*/);
84 extern int bench_measure(struct bench_timing */*t_out*/,
85 struct bench_state */*b*/,
86 bench_fn */*fn*/, void */*p*/);
88 /*----- That's all, folks -------------------------------------------------*/