1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
/*
* Copyright 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* benchmark.hpp -- This file contains interface for creating benchmarks to the
* pmembench framework. The _most_ important data structure is
* struct benchmark_info which should be properly filled and registered by the
* benchmark. Some fields should be filled by meta-data and information about
* the benchmark like: name, brief description, supported operation modes etc.
* The other group of fields are function callbacks which may be implemented by
* the benchmark. Some callbacks are required, others are optional. This is
* indicated in the structure description.
*
* To register a benchmark you can use the special macro
* REGISTER_BENCHMARK() which takes static benchmark_info data structure as an
* argument. You can also use the pmembench_register() function. Please note
* that registering a benchmark should be done at initialization time. You can
* achieve this by specifying pmembench_init macro in function attributes:
*
* static void pmembench_init my_benchmark_init()
* {
* pmembench_register(&my_benchmark);
* }
*
* However using the REGISTER_BENCHMARK() macro is recommended.
*/
;
/*
* benchmark_args - Arguments for benchmark.
*
* It contains set of common arguments and pointer to benchmark's specific
* arguments which are automatically processed by framework according to
* clos, nclos and opt_size in benchmark_info structure.
*/
;
/*
* benchmark_results - Benchmark's execution results.
*/
;
/*
* Command Line Option integer value base.
*/
/*
* Command Line Option type.
*/
;
/*
* Description of command line option.
*
* This structure is used to declare command line options by the benchmark
* which will be automatically parsed by the framework.
*
* opt_short : Short option char. If there is no short option write 0.
* opt_long : Long option string.
* descr : Description of command line option.
* off : Offset in data structure in which the value should be stored.
* type : Type of command line option.
* def : Default value. If set to NULL, this options is required.
* ignore_in_res: Do not print in results.
* check : Optional callback for checking the command line option value.
* type_int : Parameters for signed integer.
* type_uint : Parameters for unsigned integer.
* type_str : Parameters for string.
*
* size : Size of integer value. Valid values: 1, 2, 4, 8.
* base : Integer base system from which the parsing should be
* performed. This field may be used as bit mask by logically
* adding different base types.
* limit_min : Indicates whether value should be limited by the minimum
* value.
* limit_max : Indicates whether value should be limited by the maximum
* value.
* min : Minimum value when limit_min is set.
* max : Maximum value when limit_min is set.
*
* alloc : If set to true the framework should allocate memory for the
* value. The memory will be freed by the framework at the end of
* execution. Otherwise benchmark must provide valid pointer in
* opt_var and max_size parameter must be set properly.
* max_size : Maximum size of string.
*/
;
/*
* worker_info - Worker thread's information structure.
*/
;
/*
* operation_info - Information about operation.
*/
;
/*
* struct benchmark_info -- benchmark descriptor
* name : Name of benchmark.
* brief : Brief description of benchmark.
* clos : Command line options which will be automatically parsed by
* framework.
* nclos : Number of command line options.
* opts_size : Size of data structure where the parsed values should be
* stored in.
* print_help : Callback for printing help message.
* pre_init : Function for initialization of the benchmark before parsing
* command line arguments.
* init : Function for initialization of the benchmark after parsing
* command line arguments.
* exit : Function for de-initialization of the benchmark.
* multithread : Indicates whether the benchmark operation function may be
* run in many threads.
* multiops : Indicates whether the benchmark operation function may be
* run many time in a loop.
* measure_time : Indicates whether the benchmark framework should measure the
* execution time of operation function. If set to false, the
* benchmark must report the execution time by itself.
* init_worker : Callback for initialization thread specific data. Invoked in
* a single thread for every thread worker.
* operation : Callback function which does the main job of benchmark.
* rm_file : Indicates whether the test file should be removed by
* framework before the init function will be called.
* allow_poolset: Indicates whether benchmark may use poolset files.
* If set to false and fname points to a poolset, an error
* will be returned.
* According to multithread and single_operation flags it may be
* invoked in different ways:
* +-------------+----------+-------------------------------------+
* | multithread | multiops | description |
* +-------------+----------+-------------------------------------+
* | false | false | invoked once, in one thread |
* +-------------+----------+-------------------------------------+
* | false | true | invoked many times, in one thread |
* +-------------+----------+-------------------------------------+
* | true | false | invoked once, in many threads |
* +-------------+----------+-------------------------------------+
* | true | true | invoked many times, in many threads |
* +-------------+----------+-------------------------------------+
*
*/
;
void *;
void ;
struct benchmark_info *;
int ;
/* _BENCHMARK_H */