xref: /aosp_15_r20/external/libxkbcommon/bench/bench.h (revision 2b949d0487e80d67f1fda82db69e101e761f8064)
1*2b949d04SAndroid Build Coastguard Worker /*
2*2b949d04SAndroid Build Coastguard Worker  * Copyright © 2015 Kazunobu Kuriyama <[email protected]>
3*2b949d04SAndroid Build Coastguard Worker  *                  Ran Benita <[email protected]>
4*2b949d04SAndroid Build Coastguard Worker  *
5*2b949d04SAndroid Build Coastguard Worker  * Permission is hereby granted, free of charge, to any person obtaining a
6*2b949d04SAndroid Build Coastguard Worker  * copy of this software and associated documentation files (the "Software"),
7*2b949d04SAndroid Build Coastguard Worker  * to deal in the Software without restriction, including without limitation
8*2b949d04SAndroid Build Coastguard Worker  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9*2b949d04SAndroid Build Coastguard Worker  * and/or sell copies of the Software, and to permit persons to whom the
10*2b949d04SAndroid Build Coastguard Worker  * Software is furnished to do so, subject to the following conditions:
11*2b949d04SAndroid Build Coastguard Worker  *
12*2b949d04SAndroid Build Coastguard Worker  * The above copyright notice and this permission notice (including the next
13*2b949d04SAndroid Build Coastguard Worker  * paragraph) shall be included in all copies or substantial portions of the
14*2b949d04SAndroid Build Coastguard Worker  * Software.
15*2b949d04SAndroid Build Coastguard Worker  *
16*2b949d04SAndroid Build Coastguard Worker  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17*2b949d04SAndroid Build Coastguard Worker  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18*2b949d04SAndroid Build Coastguard Worker  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19*2b949d04SAndroid Build Coastguard Worker  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20*2b949d04SAndroid Build Coastguard Worker  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21*2b949d04SAndroid Build Coastguard Worker  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22*2b949d04SAndroid Build Coastguard Worker  * DEALINGS IN THE SOFTWARE.
23*2b949d04SAndroid Build Coastguard Worker  */
24*2b949d04SAndroid Build Coastguard Worker 
25*2b949d04SAndroid Build Coastguard Worker #ifndef LIBXKBCOMMON_BENCH_H
26*2b949d04SAndroid Build Coastguard Worker #define LIBXKBCOMMON_BENCH_H
27*2b949d04SAndroid Build Coastguard Worker 
28*2b949d04SAndroid Build Coastguard Worker struct bench_time {
29*2b949d04SAndroid Build Coastguard Worker     long seconds;
30*2b949d04SAndroid Build Coastguard Worker     long microseconds;
31*2b949d04SAndroid Build Coastguard Worker };
32*2b949d04SAndroid Build Coastguard Worker 
33*2b949d04SAndroid Build Coastguard Worker struct bench {
34*2b949d04SAndroid Build Coastguard Worker     struct bench_time start;
35*2b949d04SAndroid Build Coastguard Worker     struct bench_time stop;
36*2b949d04SAndroid Build Coastguard Worker };
37*2b949d04SAndroid Build Coastguard Worker 
38*2b949d04SAndroid Build Coastguard Worker void
39*2b949d04SAndroid Build Coastguard Worker bench_start(struct bench *bench);
40*2b949d04SAndroid Build Coastguard Worker void
41*2b949d04SAndroid Build Coastguard Worker bench_stop(struct bench *bench);
42*2b949d04SAndroid Build Coastguard Worker 
43*2b949d04SAndroid Build Coastguard Worker void
44*2b949d04SAndroid Build Coastguard Worker bench_elapsed(const struct bench *bench, struct bench_time *result);
45*2b949d04SAndroid Build Coastguard Worker /* The caller is responsibile to free() the returned string. */
46*2b949d04SAndroid Build Coastguard Worker char *
47*2b949d04SAndroid Build Coastguard Worker bench_elapsed_str(const struct bench *bench);
48*2b949d04SAndroid Build Coastguard Worker 
49*2b949d04SAndroid Build Coastguard Worker #endif /* LIBXKBCOMMON_BENCH_H */
50