Motr  M0
ub.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2020 Seagate Technology LLC and/or its Affiliates
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * For any questions about this software or licensing,
17  * please email opensource@seagate.com or cortx-questions@seagate.com.
18  *
19  */
20 
21 
22 #pragma once
23 
24 #ifndef __MOTR_LIB_UB_H__
25 #define __MOTR_LIB_UB_H__
26 
27 #include "lib/types.h"
28 #include "lib/time.h"
29 #include "lib/assert.h"
30 
37 #define M0_UB_ASSERT(cond) M0_ASSERT(cond)
38 
42 struct m0_ub_bench {
44  const char *ub_name;
46  uint32_t ub_iter;
47  uint32_t ub_block_size;
48  uint32_t ub_blocks_per_op;
50  void (*ub_round)(int iter);
52  void (*ub_init)(void);
54  void (*ub_fini)(void);
55 
56  /* Fields used privately in the implementation: */
57 
59  double ub_total;
62  double ub_square;
64  double ub_min;
66  double ub_max;
67 };
68 
70 
74 struct m0_ub_set {
76  const char *us_name;
77 
86  int (*us_init)(const char *opts);
87 
89  void (*us_fini)(void);
90 
91  struct m0_ub_set *us_prev;
92 
95 };
96 
100 M0_INTERNAL void m0_ub_set_print(void);
101 
110 M0_INTERNAL int m0_ub_set_select(const char *name);
111 
115 M0_INTERNAL void m0_ub_set_add(struct m0_ub_set *set);
116 
126 M0_INTERNAL int m0_ub_run(uint32_t rounds, const char *opts);
127 
129 #endif /* __MOTR_LIB_UB_H__ */
130 
131 /*
132  * Local variables:
133  * c-indentation-style: "K&R"
134  * c-basic-offset: 8
135  * tab-width: 8
136  * fill-column: 80
137  * scroll-step: 1
138  * End:
139  */
double ub_min
Definition: ub.h:64
uint64_t m0_time_t
Definition: time.h:37
void(* ub_round)(int iter)
Definition: ub.h:50
Definition: ub.h:42
struct m0_ub_bench us_run[M0_UB_SET_BENCHMARKS_MAX]
Definition: ub.h:94
uint32_t ub_blocks_per_op
Definition: ub.h:48
void(* ub_init)(void)
Definition: ub.h:52
const char * name
Definition: trace.c:110
M0_INTERNAL int m0_ub_run(uint32_t rounds, const char *opts)
Definition: ub.c:182
void(* ub_fini)(void)
Definition: ub.h:54
const char * us_name
Definition: ub.h:76
int(* us_init)(const char *opts)
Definition: ub.h:86
struct m0_ub_set * us_prev
Definition: ub.h:91
const char * ub_name
Definition: ub.h:44
double ub_square
Definition: ub.h:62
double ub_max
Definition: ub.h:66
M0_INTERNAL int m0_ub_set_select(const char *name)
Definition: ub.c:54
uint32_t ub_block_size
Definition: ub.h:47
M0_INTERNAL void m0_ub_set_print(void)
Definition: ub.c:45
m0_time_t ub_total_etime
Definition: ub.h:60
void(* us_fini)(void)
Definition: ub.h:89
uint32_t ub_iter
Definition: ub.h:46
Definition: ub.h:74
double ub_total
Definition: ub.h:59
M0_INTERNAL void m0_ub_set_add(struct m0_ub_set *set)
Definition: ub.c:69