Motr  M0
crate_utils.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2017-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_M0CRATE_CRATE_UTILS_H__
26 #define __MOTR_M0CRATE_CRATE_UTILS_H__
27 
28 #include <stdlib.h>
29 #include <stdio.h>
30 #include <fcntl.h>
31 #include <sys/types.h>
32 #include <sys/time.h>
33 #include <assert.h>
34 #include <stdarg.h>
35 #include <unistd.h>
36 
37 
44 typedef unsigned long long bcnt_t;
45 unsigned long long getnum(const char *str, const char *msg);
46 void init_rand_generator(unsigned long long seed);
47 int generate_fid(int seed, unsigned long *low, unsigned long *high);
48 unsigned char *calc_md5sum (char *buffer, int blocksize);
49 void timeval_norm(struct timeval *t);
50 void timeval_diff(const struct timeval *start, const struct timeval *end,
51  struct timeval *diff);
52 void timeval_add(struct timeval *sum, struct timeval *term);
53 void timeval_sub(struct timeval *end, struct timeval *start);
54 double tsec(const struct timeval *tval);
55 double rate(bcnt_t items, const struct timeval *tval, int scale);
56 unsigned long long genrand64_int64(void);
57 
59 #endif /* __MOTR_M0CRATE_CRATE_UTILS_H__ */
60 
61 /*
62  * Local variables:
63  * c-indentation-style: "K&R"
64  * c-basic-offset: 8
65  * tab-width: 8
66  * fill-column: 80
67  * scroll-step: 1
68  * End:
69  */
70 /*
71  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
72  */
static int(* diff[M0_PARITY_CAL_ALGO_NR])(struct m0_parity_math *math, struct m0_buf *old, struct m0_buf *new, struct m0_buf *parity, uint32_t index)
Definition: parity_math.c:290
double tsec(const struct timeval *tval)
Definition: crate_utils.c:212
unsigned char * calc_md5sum(char *buffer, int blocksize)
Definition: crate_utils.c:53
void timeval_norm(struct timeval *t)
Definition: crate.c:204
static void low(struct m0_net_buffer_pool *bp)
double rate(bcnt_t items, const struct timeval *tval, int scale)
Definition: crate_utils.c:217
static int sum
Definition: rwlock.c:53
void init_rand_generator(unsigned long long seed)
Definition: crate_utils.c:173
unsigned long long getnum(const char *str, const char *msg)
Definition: crate_utils.c:222
unsigned long long genrand64_int64(void)
Definition: crate_utils.c:112
void timeval_sub(struct timeval *end, struct timeval *start)
Definition: crate_utils.c:205
static struct m0_thread t[8]
Definition: service_ut.c:1230
unsigned long long bcnt_t
Definition: crate_utils.h:44
void timeval_add(struct timeval *sum, struct timeval *term)
Definition: crate_utils.c:198
Definition: addb2.c:200
static int start(struct m0_fom *fom)
Definition: trigger_fom.c:321
struct m0_rpc_fop_session_terminate term
Definition: session.c:53
int generate_fid(int seed, unsigned long *low, unsigned long *high)
Definition: crate_utils.c:181
void timeval_diff(const struct timeval *start, const struct timeval *end, struct timeval *diff)
Definition: crate_utils.c:189