|
1 /* |
|
2 * LIBOIL - Library of Optimized Inner Loops |
|
3 * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org> |
|
4 * All rights reserved. |
|
5 * |
|
6 * Redistribution and use in source and binary forms, with or without |
|
7 * modification, are permitted provided that the following conditions |
|
8 * are met: |
|
9 * 1. Redistributions of source code must retain the above copyright |
|
10 * notice, this list of conditions and the following disclaimer. |
|
11 * 2. Redistributions in binary form must reproduce the above copyright |
|
12 * notice, this list of conditions and the following disclaimer in the |
|
13 * documentation and/or other materials provided with the distribution. |
|
14 * |
|
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
|
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
|
19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
|
23 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
|
24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
25 * POSSIBILITY OF SUCH DAMAGE. |
|
26 */ |
|
27 |
|
28 #ifndef _LIBOIL_TEST_H_ |
|
29 #define _LIBOIL_TEST_H_ |
|
30 |
|
31 #include <liboil/liboil.h> |
|
32 #include <liboil/liboilutils.h> |
|
33 #include <liboil/liboilprototype.h> |
|
34 #include <liboil/liboilprofile.h> |
|
35 |
|
36 OIL_BEGIN_DECLS |
|
37 |
|
38 #ifdef OIL_ENABLE_UNSTABLE_API |
|
39 |
|
40 /** |
|
41 * OilTest: |
|
42 * |
|
43 * An opaque structure describing how to test an OilFunctionImpl |
|
44 * for an OilFunctionClass. |
|
45 */ |
|
46 struct _OilTest { |
|
47 /*< private >*/ |
|
48 OilFunctionClass *klass; |
|
49 OilFunctionImpl *impl; |
|
50 OilPrototype *proto; |
|
51 OilParameter params[OIL_ARG_LAST]; |
|
52 OilProfile prof; |
|
53 |
|
54 int iterations; |
|
55 int n; |
|
56 int m; |
|
57 |
|
58 int inited; |
|
59 int tested_ref; |
|
60 |
|
61 double sum_abs_diff; |
|
62 int n_points; |
|
63 |
|
64 double profile_ave; |
|
65 double profile_std; |
|
66 |
|
67 double tolerance; |
|
68 }; |
|
69 |
|
70 /** |
|
71 * OilTestFunction: |
|
72 * @test: the @OilTest structure |
|
73 * |
|
74 * Typedef for functions that initialize special values |
|
75 * in source arrays for a particular function class. |
|
76 */ |
|
77 //typedef void (*OilTestFunction) (OilTest *test); |
|
78 |
|
79 /** |
|
80 * OIL_TEST_HEADER: |
|
81 * |
|
82 * Default number of bytes that are prepended to the array test area. |
|
83 */ |
|
84 #define OIL_TEST_HEADER 256 |
|
85 /** |
|
86 * OIL_TEST_FOOTER: |
|
87 * |
|
88 * Default number of bytes that are appended to the array test area. |
|
89 */ |
|
90 #define OIL_TEST_FOOTER 256 |
|
91 |
|
92 IMPORT_C OilTest *oil_test_new (OilFunctionClass *klass); |
|
93 IMPORT_C void oil_test_free (OilTest *test); |
|
94 |
|
95 IMPORT_C void oil_test_set_iterations (OilTest *test, int iterations); |
|
96 |
|
97 IMPORT_C void oil_test_check_ref (OilTest *test); |
|
98 IMPORT_C int oil_test_check_impl (OilTest *test, OilFunctionImpl *impl); |
|
99 |
|
100 IMPORT_C void oil_test_cleanup (OilTest *test); |
|
101 IMPORT_C void oil_test_init (OilTest *test); |
|
102 |
|
103 IMPORT_C void oil_test_set_test_header (OilTest *test, OilParameter *p, int test_header); |
|
104 IMPORT_C void oil_test_set_test_footer (OilTest *test, OilParameter *p, int test_footer); |
|
105 |
|
106 void _oil_test_marshal_function (void *func, unsigned long *args, int n_args, |
|
107 unsigned int pointer_mask, OilProfile *prof); |
|
108 |
|
109 IMPORT_C void *oil_test_get_source_data (OilTest *test, OilArgType arg_type); |
|
110 IMPORT_C int oil_test_get_arg_pre_n (OilTest *test, OilArgType arg_type); |
|
111 IMPORT_C int oil_test_get_arg_post_n (OilTest *test, OilArgType arg_type); |
|
112 IMPORT_C int oil_test_get_arg_stride (OilTest *test, OilArgType arg_type); |
|
113 IMPORT_C int oil_test_get_value (OilTest *test, OilArgType arg_type); |
|
114 |
|
115 #endif |
|
116 |
|
117 OIL_END_DECLS |
|
118 |
|
119 #endif |
|
120 |