forked from hse-project/hse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkvdb_rparams.h
192 lines (167 loc) · 5.37 KB
/
kvdb_rparams.h
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
/* SPDX-License-Identifier: Apache-2.0 */
/*
* Copyright (C) 2015-2020 Micron Technology, Inc. All rights reserved.
*/
#ifndef HSE_KVDB_RPARAMS_H
#define HSE_KVDB_RPARAMS_H
#include <hse_ikvdb/throttle.h>
#include <stddef.h>
/**
* struct kvdb_rparams -
* @read_only: readonly flag
* @throttle_disable: disable put/del throttling
* @perfc_enable: priority level. 0 implies default(2).
* @log_lvl: log level for hse_log.
* @log_squelch_ns: log squelch window in nsec
* @keylock_tables: number of keylock hash tables
* @keylock_entries: number of entries in the keylock hash table
* @txn_wkth_delay: delay (msecs) to invoke transaction worker thread
* @cndb_entries: max number of entries CNDB's in memory structures. Note
* that this does not affect the MDC's size.
* @pct_bandwidth: qos, % mpoolbandwidth for the kvdb
* @iotag2vq: qos, association iotags to mpool qos virtual queues.
* @vq_w: qos, virtual queues weights
*
* The following tunable parameters can have a major impact on the way KVDB
* operates. Test thoroughly after any modifications.
*
* To improve cacheline utilization, group frequently accessed fields
* towards the beginning of this structure, and rarely accesssed
* fields towards the end.
*/
struct kvdb_rparams {
unsigned int read_only;
unsigned int throttle_disable;
unsigned int perfc_enable;
unsigned long throttle_update_ns;
unsigned long sos_log;
unsigned long c0_heap_cache_sz_max;
unsigned long c0_heap_sz;
unsigned int c0_debug;
unsigned int c0_diag_mode;
unsigned long c0_ingest_delay;
unsigned long c0_ingest_width;
unsigned long c0_coalesce_sz;
unsigned long txn_heap_sz;
unsigned long txn_ingest_delay;
unsigned long txn_ingest_width;
unsigned long txn_timeout;
unsigned int csched_policy;
unsigned long csched_debug_mask;
unsigned long csched_node_len_max;
unsigned long csched_qthreads;
unsigned long csched_samp_max;
unsigned long csched_lo_th_pct;
unsigned long csched_hi_th_pct;
unsigned long csched_leaf_pct;
unsigned long csched_vb_scatter_pct;
unsigned long csched_rspill_params;
unsigned long csched_ispill_params;
unsigned long csched_leaf_comp_params;
unsigned long csched_leaf_len_params;
unsigned long csched_node_min_ttl;
unsigned long csched_wr_burst_sz;
unsigned long csched_wr_rate_max;
unsigned long dur_enable;
unsigned long dur_intvl_ms;
unsigned long dur_buf_sz;
unsigned long dur_vbb;
unsigned long dur_delay_pct;
unsigned long dur_throttle_enable;
unsigned long dur_throttle_lo_th;
unsigned long dur_throttle_hi_th;
unsigned int throttle_relax;
unsigned int throttle_debug;
unsigned int throttle_debug_intvl_s;
unsigned long throttle_c0_hi_th;
unsigned long throttle_sleep_min_ns;
char throttle_init_policy[THROTTLE_INIT_POLICY_NAME_LEN_MAX];
/* The following fields are typically only accessed by kvdb open
* and hence are extremely cold.
*/
unsigned int log_lvl;
unsigned long log_squelch_ns;
unsigned long txn_wkth_delay;
unsigned int cndb_entries;
unsigned int c0_maint_threads;
unsigned int c0_ingest_threads;
unsigned int c0_mutex_pool_sz;
unsigned int keylock_entries;
unsigned int keylock_tables;
unsigned int low_mem;
unsigned int excl;
unsigned int rpmagic;
};
void
kvdb_rparams_table_reset(void);
struct param_inst *
kvdb_rparams_table(void);
/**
* kvdb_rparams_parse() -
* @argc: Number of argv elements
* @argv: Vector of argument strings
* @params: Structure to be populated
* @next_arg: An index into the the argv elements, will be set to first arg
* in list that is not a param
*
* Parse the parameters in argv and populate the structure 'params'
* accordingly
*/
int
kvdb_rparams_parse(int argc, char **argv, struct kvdb_rparams *params, int *next_arg);
void
kvdb_rparams_free(struct kvdb_rparams *rparams);
/**
* kvdb_rparams_help() -
* @buf: Buffer to be filled with the help message
* @buf_len: Length of buf
* @rparams: pointer to a kvdb_rparams struct that holds the custom default
* values. If this arg is NULL, system
* defaults(kvdb_rparams_defaults) will be used
*
* Fills buf with a help string
*
* Return: a pointer to the buffer buf
*/
char *
kvdb_rparams_help(char *buf, size_t buf_len, struct kvdb_rparams *rparams);
/**
* kvdb_rparams_validate() -
* @params:
*
* Check if the parameters are valid
*/
int
kvdb_rparams_validate(struct kvdb_rparams *params);
/**
* kvdb_rparams_print() -
* @rp:
*
* Prints all parameter values to the log
*/
void
kvdb_rparams_print(struct kvdb_rparams *rp);
/**
* kvdb_rparams_defaults() -
*
* Returns a kvdb_rparams structure set to default values
*/
struct kvdb_rparams
kvdb_rparams_defaults(void);
/**
* kvdb_get_num_rparams() - get total number of runtime parameters
*/
unsigned int
kvdb_get_num_rparams(void);
/**
* kvdb_rparams_diff() - invokes callback for non-default values
* @rp: rparams to compare against
* @arg: optional callback argument
* @callback: invoked as callback(key, value, arg) for non-default values
*/
void
kvdb_rparams_diff(
struct kvdb_rparams *rp,
void * arg,
void (*callback)(const char *, const char *, void *));
#endif /* HSE_KVDB_RPARAMS_H */