| 177 | }; |
| 178 | |
| 179 | struct hs_longrun_thread_base : public thread_base { |
| 180 | struct arg_type { |
| 181 | int id; |
| 182 | std::string worker_type; |
| 183 | char op; |
| 184 | int lock_flag; |
| 185 | const hs_longrun_shared& sh; |
| 186 | arg_type(int id, const std::string& worker_type, char op, int lock_flag, |
| 187 | const hs_longrun_shared& sh) |
| 188 | : id(id), worker_type(worker_type), op(op), lock_flag(lock_flag), |
| 189 | sh(sh) { } |
| 190 | }; |
| 191 | arg_type arg; |
| 192 | hs_longrun_stat stat; |
| 193 | drand48_data randbuf; |
| 194 | unsigned int seed; |
| 195 | hs_longrun_thread_base(const arg_type& arg) |
| 196 | : arg(arg), seed(0) { |
| 197 | seed = time(0) + arg.id + 1; |
| 198 | srand48_r(seed, &randbuf); |
| 199 | } |
| 200 | virtual ~hs_longrun_thread_base() { } |
| 201 | virtual void run() = 0; |
| 202 | size_t rand_record() { |
| 203 | double v = 0; |
| 204 | drand48_r(&randbuf, &v); |
| 205 | const size_t sz = arg.sh.records.size(); |
| 206 | size_t r = size_t(v * sz); |
| 207 | if (r >= sz) { |
| 208 | r = 0; |
| 209 | } |
| 210 | return r; |
| 211 | } |
| 212 | int verify_update(const std::string& k, const std::string& v1, |
| 213 | const std::string& v2, const std::string& v3, record_value& rec, |
| 214 | uint32_t num_rows, bool cur_unknown_state); |
| 215 | int verify_read(const std::string& k, uint32_t num_rows, uint32_t num_flds, |
| 216 | const std::string rrec[4], record_value& rec); |
| 217 | int verify_readnolock(const std::string& k, uint32_t num_rows, |
| 218 | uint32_t num_flds, const std::string rrec[4]); |
| 219 | }; |
| 220 | |
| 221 | int |
| 222 | hs_longrun_thread_base::verify_update(const std::string& k, |
nothing calls this directly
no outgoing calls
no test coverage detected