144 #define LOG_PREFIX "dix: "   149 #       define M0_RC(X) (X)   151 #       define M0_ERR(X) (X)   157 #       define M0_ASSERT(X)   196         res = (val_h << 32) | val_l;
   204         return rand() % 2 == 1;
   210         char set[] = 
"0123456789"   211                 "abcdefghijklmnopqrstuvwxyz"   212                 "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   213         const size_t set_len = strlen(
set);
   217         for (
i = 0; 
i < length  - 1; 
i++)
   223         dest[length - 1] = 
'\0';
   303                 for (
i = 0; 
i < 
nr; 
i++)
   362                                    int *keys, 
size_t keys_nr,
   368                                int *keys, 
size_t nr_keys);
   371                                int *keys, 
size_t nr_keys);
   417         fprintf(stdout, 
"result: total_s, %f, avg_time_per_op_ns, %.1f,"   418                 " key_size_bytes, %d, value_size_bytes, %d, ops, %d\n",
   423                 fprintf(stdout, 
"result: %s, total_time_s, %f, avg_time_per_op_ns, "   432         fprintf(stdout, 
"\nTotal: time="TIME_F" ("TIME_F" per op) ops=%d\n",
   440                         fprintf(stdout, 
"%s: "TIME_F" ("TIME_F" per op) ops=%d\n",
   463         *ciw = (typeof(*ciw)) {};
   589                                    int *keys, 
size_t keys_nr,
   684                        int kpart_one_size, 
char *kpart_one)
   696         for (
i = 0; 
i < 
nr; 
i++) {
   699                 memcpy(
p->k->ov_buf[
i], (
void*)kpart_one, kpart_one_size);
   700                 memcpy(
p->k->ov_buf[
i] + kpart_one_size, &k[
i], 
sizeof(*k));
   709                         int kpart_one_size, 
char *kpart_one)
   726         memcpy(
p->k->ov_buf[0], (
void*)kpart_one, kpart_one_size);
   727         memcpy(
p->k->ov_buf[0] + kpart_one_size, &k[0], 
sizeof(*k));
   735                        int kpart_one_size, 
char *kpart_one)
   752         for (
i = 0; 
i < 
nr; 
i++) {
   755                 memcpy(
p->k->ov_buf[
i], (
void*)kpart_one, kpart_one_size);
   756                 memcpy(
p->k->ov_buf[
i] + kpart_one_size, &k[
i], 
sizeof(*k));
   764                        int kpart_one_size, 
char *kpart_one)
   782         for (
i = 0; 
i < 
nr; 
i++) {
   786                 memcpy(
p->k->ov_buf[
i], (
void*)kpart_one, kpart_one_size);
   787                 memcpy(
p->k->ov_buf[
i] + kpart_one_size, &k[
i], 
sizeof(*k));
   789                 p->v->ov_vec.v_count[
i] = vlen;
   795                       vlen > 128 ? 
"<...>": (
char *) 
p->v->ov_buf[
i]);
   880         for (
i = 0; 
i < 
nr; 
i++) {
   881                 for (j = 0; j < 
nr; j++) {
   882                         if (
i != j && vals[
i] == vals[j])
   892                                int *keys, 
size_t nr_keys)
   910                         keys[key_iter++] = 
i;
   911                         if (key_iter == nr_keys)
   916         if (key_iter != nr_keys) {
   934                                 int *keys, 
size_t nr_keys)
   944         while (key_iter != nr_keys) {
   945                 if (attempts > w->
bm.
b_nr &&
   989         kv_nr = 
p->k->ov_vec.v_nr;
  1016                               "Failed to perform client operation %s: k="  1017                               FID_F " %s (%d), index=%d",
  1020                               strerror(-
rc), 
rc, kv_index);
  1023                               "Failed to perform client operation %s: k="  1030                 rc = 
ops[0]->op_sm.sm_rc;
  1065         char                     kpart_one[kpart_one_size];
  1089         rc = find_fn(w, 
opcode, ikeys, nr_keys);
  1093                         *missing_key = 
true;
  1098         for (
i = 0; 
i < nr_keys; 
i++) {
  1104         memset(kpart_one, 
'A', kpart_one_size);
  1106         rc = 
op->fill_kv(w, keys, &kv, nr_keys, kpart_one_size, kpart_one);
  1127                 for (
i = 0; 
i < nr_keys; 
i++)
  1159         int            max_ops_cnt = 0;
  1174         if (max_ops_cnt == 0) {
  1240         bool result = 
false;
  1259         bool           missing_key = 
false;
  1340                 else if (
ops[0]->op_sm.sm_rc != 0) {
  1341                         if (
ops[0]->op_sm.sm_rc == -ENOENT)
  1344                                 rc = 
ops[0]->op_sm.sm_rc;
  1381                 else if (
ops[0]->op_sm.sm_rc != 0) {
  1382                         if (
ops[0]->op_sm.sm_rc == -EEXIST)
  1385                                 rc = 
ops[0]->op_sm.sm_rc;
  1487         memcpy(&index_fid, &wit->
index_fid, 
sizeof(index_fid));
  1553         if (!is_m0_thread) {
  1565                       "Failed to perform index operation (%s)",
  1569         if (!is_m0_thread) {
 
static void cr_idx_w_fini(struct cr_idx_w *ciw)
 
struct cr_watchdog * cr_watchdog
 
static struct m0_addb2_philter p
 
static void cr_idx_w_print_ops_table(struct cr_idx_w *w)
 
static size_t cr_rand_pos_range_l(size_t end)
 
void m0_op_run_index(struct workload *w, struct workload_task *task, const struct workload_op *op)
 
static int cr_idx_w_warmup(struct cr_idx_w *w)
 
#define M0_ALLOC_ARR(arr, nr)
 
M0_INTERNAL int m0_bitmap_init(struct m0_bitmap *map, size_t nr)
 
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
 
static bool cr_idx_w_rebalance_ops(struct cr_idx_w *w, enum cr_opcode op)
 
static bool m0_bitmap_is_fulfilled(struct m0_bitmap *bm, bool fill)
 
int const char const void size_t int flags
 
static void cr_get_random_string(char *dest, size_t length)
 
M0_INTERNAL void m0_bitmap_fini(struct m0_bitmap *map)
 
struct m0_workload_index * wit
 
double ciwr_time_per_op_ns
 
int m0_thread_join(struct m0_thread *q)
 
const m0_time_t M0_TIME_NEVER
 
void m0_op_fini(struct m0_op *op)
 
double cior_time_per_op_ns
 
void run_index(struct workload *w, struct workload_task *tasks)
 
static int cr_idx_w_seq_keys_get_last(struct cr_idx_w *w, int nr, enum cr_opcode op)
 
uint64_t m0_time_nanoseconds(const m0_time_t time)
 
static int cr_idx_w_init(struct cr_idx_w *ciw, struct m0_workload_index *wit)
 
static void cr_time_capture_results(struct cr_time_measure_ctx *t, struct cr_idx_w *ciw)
 
#define m0_exists(var, nr,...)
 
void m0_idx_fini(struct m0_idx *idx)
 
M0_INTERNAL int m0_pageshift_get(void)
 
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
 
int opcode_prcnt[CRATE_OP_TYPES]
 
const char * cior_op_label
 
m0_time_t m0_time(uint64_t secs, long ns)
 
static void cr_watchdog_touch()
 
static int cr_rand_pos_range(int end)
 
void workload_start(struct workload *w, struct workload_task *task)
 
int adopt_motr_thread(struct m0_workload_task *task)
 
static int fill_kv_next(struct cr_idx_w *w, struct m0_fid *k, struct kv_pair *p, size_t nr, int kpart_one_size, char *kpart_one)
 
int32_t m0_op_wait(struct m0_op *op, uint64_t bits, m0_time_t to)
 
int m0_idx_op(struct m0_idx *idx, enum m0_idx_opcode opcode, struct m0_bufvec *keys, struct m0_bufvec *vals, int32_t *rcs, uint32_t flags, struct m0_op **op)
 
static enum cr_opcode cr_idx_w_select_op(struct cr_idx_w *w)
 
static int cr_idx_w_find_seq_k(struct cr_idx_w *w, enum cr_opcode opcode, int *keys, size_t nr_keys)
 
M0_INTERNAL struct m0_thread_tls * m0_thread_tls(void)
 
M0_INTERNAL void m0_bufvec_free(struct m0_bufvec *bufvec)
 
static void cr_idx_w_seq_keys_fini(struct cr_idx_w *w)
 
struct m0_entity in_entity
 
int(* cr_idx_w_find_k_t)(struct cr_idx_w *w, enum cr_opcode opcode, int *keys, size_t nr_keys)
 
static int cr_idx_w_get_nr_remained_op_types(struct cr_idx_w *w)
 
static void cr_watchdog_thread(void *arg)
 
static void cr_idx_w_seq_keys_save(struct cr_idx_w *w, int *keys, size_t keys_nr, enum cr_opcode op)
 
static void cr_time_measure_begin(struct cr_time_measure_ctx *t)
 
return M0_ERR(-EOPNOTSUPP)
 
int(* fill_kv)(struct cr_idx_w *w, struct m0_fid *k, struct kv_pair *p, size_t nr, int kpart_one_size, char *kpart_one)
 
static double cr_time_measure_elapsed_now(struct cr_time_measure_ctx *t)
 
static int create_index(struct m0_uint128 id)
 
void workload_join(struct workload *w, struct workload_task *task)
 
static int cr_idx_w_get_nr_keys_per_op(struct cr_idx_w *w, enum cr_opcode op)
 
static size_t cr_idx_w_get_value_size(struct cr_idx_w *w)
 
M0_INTERNAL int m0_thread_signal(struct m0_thread *q, int sig)
 
static int fill_kv_del(struct cr_idx_w *w, struct m0_fid *k, struct kv_pair *p, size_t nr, int kpart_one_size, char *kpart_one)
 
m0_time_t m0_time_now(void)
 
enum cr_op_selector op_selector
 
static void cr_time_measure_end(struct cr_time_measure_ctx *t)
 
static int fill_kv_put(struct cr_idx_w *w, struct m0_fid *k, struct kv_pair *p, size_t nr, int kpart_one_size, char *kpart_one)
 
static struct m0_thread t[8]
 
struct cr_idx_ops_result ciwr_ops_result[CRATE_OP_NR]
 
struct cr_time_measure_ctx exec_time_ctx
 
int m0_thread_init(struct m0_thread *q, int(*init)(void *), void(*func)(void *), void *arg, const char *namefmt,...)
 
static M0_UNUSED bool int_array_is_set(int *vals, size_t nr)
 
void m0_thread_fini(struct m0_thread *q)
 
void m0_op_launch(struct m0_op **op, uint32_t nr)
 
void * m0_alloc(size_t size)
 
static void cr_watchdog_fini()
 
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
 
static bool cr_idx_w_seq_keys_enabled(struct cr_idx_w *w)
 
static int index_operation(struct workload *wt, struct m0_workload_task *task)
 
M0_INTERNAL void m0_bitmap_set(struct m0_bitmap *map, size_t idx, bool val)
 
m0_time_t m0_time_add(const m0_time_t t1, const m0_time_t t2)
 
uint64_t m0_time_seconds(const m0_time_t time)
 
static void kv_pair_fini(struct kv_pair *p)
 
static bool cr_rand_bool()
 
static void cr_idx_w_seq_keys_init(struct cr_idx_w *w, int keys_nr)
 
static int cr_idx_w_common(struct cr_idx_w *w)
 
#define m0_forall(var, nr,...)
 
int m0_entity_create(struct m0_fid *pool, struct m0_entity *entity, struct m0_op **op)
 
struct cr_idx_w_results ciw_results
 
static void m0_bitmap_print(struct m0_bitmap *bm)
 
static int cr_watchdog_init(struct m0_workload_index *wt)
 
m0_time_t cior_ops_total_time_m0
 
static enum cr_opcode cr_idx_w_select_op_rr(struct cr_idx_w *w, int depth)
 
#define M0_ALLOC_PTR(ptr)
 
struct cr_ops_counter nr_ops[CRATE_OP_NR]
 
char * cr_idx_op_labels[CRATE_OP_NR]
 
m0_time_t m0_time_sub(const m0_time_t t1, const m0_time_t t2)
 
M0_INTERNAL bool m0_bitmap_get(const struct m0_bitmap *map, size_t idx)
 
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
 
static M0_UNUSED int delete_index(struct m0_uint128 id)
 
static int cr_idx_w_execute(struct cr_idx_w *w, enum cr_opcode opcode, bool random, size_t nr_keys, bool *missing_key)
 
static int cr_execute_query(struct m0_fid *id, struct kv_pair *p, enum cr_opcode opcode)
 
static bool cr_idx_w_timeout_expired(struct cr_idx_w *w)
 
double cior_ops_total_time_s
 
static int cr_idx_w_find_rnd_k(struct cr_idx_w *w, enum cr_opcode opcode, int *keys, size_t nr_keys)
 
int m0_entity_delete(struct m0_entity *entity, struct m0_op **op)
 
static double cr_time_in_seconds(m0_time_t mtime)
 
static struct m0_bufvec * idx_bufvec_alloc(int nr)
 
struct m0_realm * crate_uber_realm()
 
void m0_op_free(struct m0_op *op)
 
M0_INTERNAL void * m0_alloc_aligned(size_t size, unsigned shift)
 
static void cr_time_measure_report(struct cr_time_measure_ctx *t, struct cr_idx_w w)
 
static int cr_idx_w_get_nr_remained_ops(struct cr_idx_w *w)
 
static void idx_bufvec_free(struct m0_bufvec *bv)
 
void m0_idx_init(struct m0_idx *idx, struct m0_realm *parent, const struct m0_uint128 *id)
 
void release_motr_thread(struct m0_workload_task *task)
 
static int fill_kv_get(struct cr_idx_w *w, struct m0_fid *k, struct kv_pair *p, size_t nr, int kpart_one_size, char *kpart_one)
 
void cr_log_ex(enum cr_log_level lev, const char *pre, const char *post, const char *fmt,...)
 
m0_time_t ciwr_total_time_m0
 
static bool cr_opcode_valid(enum cr_opcode opcode)
 
static const char * crate_op_to_string(enum cr_opcode op)
 
int m0_nanosleep(const m0_time_t req, m0_time_t *rem)