rippled
Timing_test.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #include <ripple/basics/BasicConfig.h>
21 #include <ripple/basics/ByteUtilities.h>
22 #include <ripple/basics/safe_cast.h>
23 #include <ripple/beast/unit_test.h>
24 #include <ripple/beast/unit_test/thread.hpp>
25 #include <ripple/beast/utility/temp_dir.h>
26 #include <ripple/beast/xor_shift_engine.h>
27 #include <ripple/nodestore/DummyScheduler.h>
28 #include <ripple/nodestore/Manager.h>
29 #include <ripple/unity/rocksdb.h>
30 #include <boost/algorithm/string.hpp>
31 #include <atomic>
32 #include <chrono>
33 #include <iterator>
34 #include <limits>
35 #include <map>
36 #include <random>
37 #include <sstream>
38 #include <stdexcept>
39 #include <test/nodestore/TestBase.h>
40 #include <test/unit_test/SuiteJournal.h>
41 #include <thread>
42 #include <type_traits>
43 #include <utility>
44 
45 #ifndef NODESTORE_TIMING_DO_VERIFY
46 #define NODESTORE_TIMING_DO_VERIFY 0
47 #endif
48 
49 namespace ripple {
50 namespace NodeStore {
51 
54  Section const& config,
55  Scheduler& scheduler,
56  beast::Journal journal)
57 {
59  config, megabytes(4), scheduler, journal);
60 }
61 
62 // Fill memory with random bits
63 template <class Generator>
64 static void
65 rngcpy(void* buffer, std::size_t bytes, Generator& g)
66 {
67  using result_type = typename Generator::result_type;
68  while (bytes >= sizeof(result_type))
69  {
70  auto const v = g();
71  memcpy(buffer, &v, sizeof(v));
72  buffer = reinterpret_cast<std::uint8_t*>(buffer) + sizeof(v);
73  bytes -= sizeof(v);
74  }
75 
76  if (bytes > 0)
77  {
78  auto const v = g();
79  memcpy(buffer, &v, bytes);
80  }
81 }
82 
83 // Instance of node factory produces a deterministic sequence
84 // of random NodeObjects within the given
85 class Sequence
86 {
87 private:
88  enum { minLedger = 1, maxLedger = 1000000, minSize = 250, maxSize = 1250 };
89 
94 
95 public:
96  explicit Sequence(std::uint8_t prefix)
97  : prefix_(prefix)
98  // uniform distribution over hotLEDGER - hotTRANSACTION_NODE
99  // but exclude hotTRANSACTION = 2 (removed)
100  , d_type_({1, 1, 0, 1, 1})
102  {
103  }
104 
105  // Returns the n-th key
106  uint256
108  {
109  gen_.seed(n + 1);
110  uint256 result;
111  rngcpy(&*result.begin(), result.size(), gen_);
112  return result;
113  }
114 
115  // Returns the n-th complete NodeObject
118  {
119  gen_.seed(n + 1);
120  uint256 key;
121  auto const data = static_cast<std::uint8_t*>(&*key.begin());
122  *data = prefix_;
123  rngcpy(data + 1, key.size() - 1, gen_);
124  Blob value(d_size_(gen_));
125  rngcpy(&value[0], value.size(), gen_);
127  safe_cast<NodeObjectType>(d_type_(gen_)), std::move(value), key);
128  }
129 
130  // returns a batch of NodeObjects starting at n
131  void
133  {
134  b.clear();
135  b.reserve(size);
136  while (size--)
137  b.emplace_back(obj(n++));
138  }
139 };
140 
141 //----------------------------------------------------------------------------------
142 
143 class Timing_test : public beast::unit_test::suite
144 {
145 public:
146  enum {
147  // percent of fetches for missing nodes
149  };
150 
152 #ifndef NDEBUG
153  std::size_t const default_items = 10000;
154 #else
155  std::size_t const default_items = 100000; // release
156 #endif
157 
160 
161  struct Params
162  {
165  };
166 
167  static std::string
168  to_string(Section const& config)
169  {
170  std::string s;
171  for (auto iter = config.begin(); iter != config.end(); ++iter)
172  s += (iter != config.begin() ? "," : "") + iter->first + "=" +
173  iter->second;
174  return s;
175  }
176 
177  static std::string
179  {
181  ss << std::fixed << std::setprecision(3) << (d.count() / 1000.) << "s";
182  return ss.str();
183  }
184 
185  static Section
187  {
188  Section section;
190  boost::split(v, s, boost::algorithm::is_any_of(","));
191  section.append(v);
192  return section;
193  }
194 
195  //--------------------------------------------------------------------------
196 
197  // Workaround for GCC's parameter pack expansion in lambdas
198  // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47226
199  template <class Body>
201  {
202  private:
205 
206  public:
208  : n_(n), c_(c)
209  {
210  }
211 
212  template <class... Args>
213  void
214  operator()(Args&&... args)
215  {
216  Body body(args...);
217  for (;;)
218  {
219  auto const i = c_++;
220  if (i >= n_)
221  break;
222  body(i);
223  }
224  }
225  };
226 
227  /* Execute parallel-for loop.
228 
229  Constructs `number_of_threads` instances of `Body`
230  with `args...` parameters and runs them on individual threads
231  with unique loop indexes in the range [0, n).
232  */
233  template <class Body, class... Args>
234  void
236  std::size_t const n,
237  std::size_t number_of_threads,
238  Args const&... args)
239  {
242  t.reserve(number_of_threads);
243  for (std::size_t id = 0; id < number_of_threads; ++id)
244  t.emplace_back(*this, parallel_for_lambda<Body>(n, c), args...);
245  for (auto& _ : t)
246  _.join();
247  }
248 
249  template <class Body, class... Args>
250  void
252  std::size_t const n,
253  std::size_t number_of_threads,
254  Args const&... args)
255  {
258  t.reserve(number_of_threads);
259  for (std::size_t id = 0; id < number_of_threads; ++id)
260  t.emplace_back(*this, parallel_for_lambda<Body>(n, c), id, args...);
261  for (auto& _ : t)
262  _.join();
263  }
264 
265  //--------------------------------------------------------------------------
266 
267  // Insert only
268  void
270  Section const& config,
271  Params const& params,
272  beast::Journal journal)
273  {
274  DummyScheduler scheduler;
275  auto backend = make_Backend(config, scheduler, journal);
276  BEAST_EXPECT(backend != nullptr);
277  backend->open();
278 
279  class Body
280  {
281  private:
282  suite& suite_;
283  Backend& backend_;
284  Sequence seq_;
285 
286  public:
287  explicit Body(suite& s, Backend& backend)
288  : suite_(s), backend_(backend), seq_(1)
289  {
290  }
291 
292  void
293  operator()(std::size_t i)
294  {
295  try
296  {
297  backend_.store(seq_.obj(i));
298  }
299  catch (std::exception const& e)
300  {
301  suite_.fail(e.what());
302  }
303  }
304  };
305 
306  try
307  {
308  parallel_for<Body>(
309  params.items,
310  params.threads,
311  std::ref(*this),
312  std::ref(*backend));
313  }
314  catch (std::exception const&)
315  {
316 #if NODESTORE_TIMING_DO_VERIFY
317  backend->verify();
318 #endif
319  Rethrow();
320  }
321  backend->close();
322  }
323 
324  // Fetch existing keys
325  void
327  Section const& config,
328  Params const& params,
329  beast::Journal journal)
330  {
331  DummyScheduler scheduler;
332  auto backend = make_Backend(config, scheduler, journal);
333  BEAST_EXPECT(backend != nullptr);
334  backend->open();
335 
336  class Body
337  {
338  private:
339  suite& suite_;
340  Backend& backend_;
341  Sequence seq1_;
344 
345  public:
346  Body(
347  std::size_t id,
348  suite& s,
349  Params const& params,
350  Backend& backend)
351  : suite_(s)
352  , backend_(backend)
353  , seq1_(1)
354  , gen_(id + 1)
355  , dist_(0, params.items - 1)
356  {
357  }
358 
359  void
360  operator()(std::size_t i)
361  {
362  try
363  {
366  obj = seq1_.obj(dist_(gen_));
367  backend_.fetch(obj->getHash().data(), &result);
368  suite_.expect(result && isSame(result, obj));
369  }
370  catch (std::exception const& e)
371  {
372  suite_.fail(e.what());
373  }
374  }
375  };
376  try
377  {
378  parallel_for_id<Body>(
379  params.items,
380  params.threads,
381  std::ref(*this),
382  std::ref(params),
383  std::ref(*backend));
384  }
385  catch (std::exception const&)
386  {
387 #if NODESTORE_TIMING_DO_VERIFY
388  backend->verify();
389 #endif
390  Rethrow();
391  }
392  backend->close();
393  }
394 
395  // Perform lookups of non-existent keys
396  void
398  Section const& config,
399  Params const& params,
400  beast::Journal journal)
401  {
402  DummyScheduler scheduler;
403  auto backend = make_Backend(config, scheduler, journal);
404  BEAST_EXPECT(backend != nullptr);
405  backend->open();
406 
407  class Body
408  {
409  private:
410  suite& suite_;
411  // Params const& params_;
412  Backend& backend_;
413  Sequence seq2_;
416 
417  public:
418  Body(
419  std::size_t id,
420  suite& s,
421  Params const& params,
422  Backend& backend)
423  : suite_(s)
424  //, params_ (params)
425  , backend_(backend)
426  , seq2_(2)
427  , gen_(id + 1)
428  , dist_(0, params.items - 1)
429  {
430  }
431 
432  void
433  operator()(std::size_t i)
434  {
435  try
436  {
437  auto const key = seq2_.key(i);
439  backend_.fetch(key.data(), &result);
440  suite_.expect(!result);
441  }
442  catch (std::exception const& e)
443  {
444  suite_.fail(e.what());
445  }
446  }
447  };
448 
449  try
450  {
451  parallel_for_id<Body>(
452  params.items,
453  params.threads,
454  std::ref(*this),
455  std::ref(params),
456  std::ref(*backend));
457  }
458  catch (std::exception const&)
459  {
460 #if NODESTORE_TIMING_DO_VERIFY
461  backend->verify();
462 #endif
463  Rethrow();
464  }
465  backend->close();
466  }
467 
468  // Fetch with present and missing keys
469  void
471  Section const& config,
472  Params const& params,
473  beast::Journal journal)
474  {
475  DummyScheduler scheduler;
476  auto backend = make_Backend(config, scheduler, journal);
477  BEAST_EXPECT(backend != nullptr);
478  backend->open();
479 
480  class Body
481  {
482  private:
483  suite& suite_;
484  // Params const& params_;
485  Backend& backend_;
486  Sequence seq1_;
487  Sequence seq2_;
491 
492  public:
493  Body(
494  std::size_t id,
495  suite& s,
496  Params const& params,
497  Backend& backend)
498  : suite_(s)
499  //, params_ (params)
500  , backend_(backend)
501  , seq1_(1)
502  , seq2_(2)
503  , gen_(id + 1)
504  , rand_(0, 99)
505  , dist_(0, params.items - 1)
506  {
507  }
508 
509  void
510  operator()(std::size_t i)
511  {
512  try
513  {
514  if (rand_(gen_) < missingNodePercent)
515  {
516  auto const key = seq2_.key(dist_(gen_));
518  backend_.fetch(key.data(), &result);
519  suite_.expect(!result);
520  }
521  else
522  {
525  obj = seq1_.obj(dist_(gen_));
526  backend_.fetch(obj->getHash().data(), &result);
527  suite_.expect(result && isSame(result, obj));
528  }
529  }
530  catch (std::exception const& e)
531  {
532  suite_.fail(e.what());
533  }
534  }
535  };
536 
537  try
538  {
539  parallel_for_id<Body>(
540  params.items,
541  params.threads,
542  std::ref(*this),
543  std::ref(params),
544  std::ref(*backend));
545  }
546  catch (std::exception const&)
547  {
548 #if NODESTORE_TIMING_DO_VERIFY
549  backend->verify();
550 #endif
551  Rethrow();
552  }
553  backend->close();
554  }
555 
556  // Simulate a rippled workload:
557  // Each thread randomly:
558  // inserts a new key
559  // fetches an old key
560  // fetches recent, possibly non existent data
561  void
562  do_work(Section const& config, Params const& params, beast::Journal journal)
563  {
564  DummyScheduler scheduler;
565  auto backend = make_Backend(config, scheduler, journal);
566  BEAST_EXPECT(backend != nullptr);
567  backend->setDeletePath();
568  backend->open();
569 
570  class Body
571  {
572  private:
573  suite& suite_;
574  Params const& params_;
575  Backend& backend_;
576  Sequence seq1_;
581 
582  public:
583  Body(
584  std::size_t id,
585  suite& s,
586  Params const& params,
587  Backend& backend)
588  : suite_(s)
589  , params_(params)
590  , backend_(backend)
591  , seq1_(1)
592  , gen_(id + 1)
593  , rand_(0, 99)
594  , recent_(params.items, params.items * 2 - 1)
595  , older_(0, params.items - 1)
596  {
597  }
598 
599  void
600  operator()(std::size_t i)
601  {
602  try
603  {
604  if (rand_(gen_) < 200)
605  {
606  // historical lookup
609  auto const j = older_(gen_);
610  obj = seq1_.obj(j);
612  backend_.fetch(obj->getHash().data(), &result);
613  suite_.expect(result != nullptr);
614  suite_.expect(isSame(result, obj));
615  }
616 
617  char p[2];
618  p[0] = rand_(gen_) < 50 ? 0 : 1;
619  p[1] = 1 - p[0];
620  for (int q = 0; q < 2; ++q)
621  {
622  switch (p[q])
623  {
624  case 0: {
625  // fetch recent
628  auto const j = recent_(gen_);
629  obj = seq1_.obj(j);
630  backend_.fetch(obj->getHash().data(), &result);
631  suite_.expect(!result || isSame(result, obj));
632  break;
633  }
634 
635  case 1: {
636  // insert new
637  auto const j = i + params_.items;
638  backend_.store(seq1_.obj(j));
639  break;
640  }
641  }
642  }
643  }
644  catch (std::exception const& e)
645  {
646  suite_.fail(e.what());
647  }
648  }
649  };
650 
651  try
652  {
653  parallel_for_id<Body>(
654  params.items,
655  params.threads,
656  std::ref(*this),
657  std::ref(params),
658  std::ref(*backend));
659  }
660  catch (std::exception const&)
661  {
662 #if NODESTORE_TIMING_DO_VERIFY
663  backend->verify();
664 #endif
665  Rethrow();
666  }
667  backend->close();
668  }
669 
670  //--------------------------------------------------------------------------
671 
672  using test_func =
673  void (Timing_test::*)(Section const&, Params const&, beast::Journal);
675 
678  test_func f,
679  Section const& config,
680  Params const& params,
681  beast::Journal journal)
682  {
683  auto const start = clock_type::now();
684  (this->*f)(config, params, journal);
685  return std::chrono::duration_cast<duration_type>(
686  clock_type::now() - start);
687  }
688 
689  void
691  std::size_t threads,
692  test_list const& tests,
693  std::vector<std::string> const& config_strings)
694  {
695  using std::setw;
696  int w = 8;
697  for (auto const& test : tests)
698  if (w < test.first.size())
699  w = test.first.size();
700  log << threads << " Thread" << (threads > 1 ? "s" : "") << ", "
701  << default_items << " Objects" << std::endl;
702  {
704  ss << std::left << setw(10) << "Backend" << std::right;
705  for (auto const& test : tests)
706  ss << " " << setw(w) << test.first;
707  log << ss.str() << std::endl;
708  }
709 
710  using namespace beast::severities;
711  test::SuiteJournal journal("Timing_test", *this);
712 
713  for (auto const& config_string : config_strings)
714  {
715  Params params;
716  params.items = default_items;
717  params.threads = threads;
718  for (auto i = default_repeat; i--;)
719  {
720  beast::temp_dir tempDir;
721  Section config = parse(config_string);
722  config.set("path", tempDir.path());
724  ss << std::left << setw(10)
725  << get(config, "type", std::string()) << std::right;
726  for (auto const& test : tests)
727  ss << " " << setw(w)
728  << to_string(
729  do_test(test.second, config, params, journal));
730  ss << " " << to_string(config);
731  log << ss.str() << std::endl;
732  }
733  }
734  }
735 
736  void
737  run() override
738  {
739  testcase("Timing", beast::unit_test::abort_on_fail);
740 
741  /* Parameters:
742 
743  repeat Number of times to repeat each test
744  items Number of objects to create in the database
745 
746  */
747  std::string default_args =
748  "type=nudb"
749 #if RIPPLE_ROCKSDB_AVAILABLE
750  ";type=rocksdb,open_files=2000,filter_bits=12,cache_mb=256,"
751  "file_size_mb=8,file_size_mult=2"
752 #endif
753 #if 0
754  ";type=memory|path=NodeStore"
755 #endif
756  ;
757 
758  test_list const tests = {
759  {"Insert", &Timing_test::do_insert},
760  {"Fetch", &Timing_test::do_fetch},
761  {"Missing", &Timing_test::do_missing},
762  {"Mixed", &Timing_test::do_mixed},
763  {"Work", &Timing_test::do_work}};
764 
765  auto args = arg().empty() ? default_args : arg();
766  std::vector<std::string> config_strings;
767  boost::split(config_strings, args, boost::algorithm::is_any_of(";"));
768  for (auto iter = config_strings.begin(); iter != config_strings.end();)
769  if (iter->empty())
770  iter = config_strings.erase(iter);
771  else
772  ++iter;
773 
774  do_tests(1, tests, config_strings);
775  do_tests(4, tests, config_strings);
776  do_tests(8, tests, config_strings);
777  // do_tests (16, tests, config_strings);
778  }
779 };
780 
781 BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(Timing, NodeStore, ripple, 1);
782 
783 } // namespace NodeStore
784 } // namespace ripple
ripple::NodeStore::Timing_test::to_string
static std::string to_string(Section const &config)
Definition: Timing_test.cpp:168
ripple::NodeStore::DummyScheduler
Simple NodeStore Scheduler that just peforms the tasks synchronously.
Definition: DummyScheduler.h:29
ripple::NodeStore::Sequence::batch
void batch(std::size_t n, Batch &b, std::size_t size)
Definition: Timing_test.cpp:132
ripple::Section
Holds a collection of configuration values.
Definition: BasicConfig.h:42
sstream
std::setprecision
T setprecision(T... args)
std::chrono::steady_clock
ripple::NodeStore::Sequence::d_size_
std::uniform_int_distribution< std::uint32_t > d_size_
Definition: Timing_test.cpp:93
std::string
STL class.
std::shared_ptr< NodeObject >
ripple::NodeStore::Sequence::minLedger
@ minLedger
Definition: Timing_test.cpp:88
ripple::NodeStore::Timing_test::default_repeat
const std::size_t default_repeat
Definition: Timing_test.cpp:151
std::uniform_int_distribution< std::uint32_t >
utility
std::exception
STL class.
ripple::NodeStore::Timing_test::do_insert
void do_insert(Section const &config, Params const &params, beast::Journal journal)
Definition: Timing_test.cpp:269
ripple::NodeStore::Sequence::maxLedger
@ maxLedger
Definition: Timing_test.cpp:88
std::discrete_distribution< std::uint32_t >
std::vector::reserve
T reserve(T... args)
std::vector< unsigned char >
std::vector::size
T size(T... args)
ripple::NodeObject::createObject
static std::shared_ptr< NodeObject > createObject(NodeObjectType type, Blob &&data, uint256 const &hash)
Create an object from fields.
Definition: NodeObject.cpp:37
ripple::NodeStore::Sequence::d_type_
std::discrete_distribution< std::uint32_t > d_type_
Definition: Timing_test.cpp:92
ripple::NodeStore::Timing_test::parallel_for_lambda::operator()
void operator()(Args &&... args)
Definition: Timing_test.cpp:214
std::chrono::milliseconds
iterator
random
std::stringstream
STL class.
beast::severities
A namespace for easy access to logging severity values.
Definition: Journal.h:29
ripple::NodeStore::Timing_test::parallel_for_lambda::c_
std::atomic< std::size_t > & c_
Definition: Timing_test.cpp:204
ripple::NodeStore::Sequence::minSize
@ minSize
Definition: Timing_test.cpp:88
ripple::NodeStore::Backend::store
virtual void store(std::shared_ptr< NodeObject > const &object)=0
Store a single object.
ripple::NodeStore::Sequence
Definition: Timing_test.cpp:85
ripple::NodeStore::Timing_test::do_fetch
void do_fetch(Section const &config, Params const &params, beast::Journal journal)
Definition: Timing_test.cpp:326
ripple::Section::begin
const_iterator begin() const
Definition: BasicConfig.h:182
ripple::NodeStore::Timing_test::missingNodePercent
@ missingNodePercent
Definition: Timing_test.cpp:148
std::vector::clear
T clear(T... args)
ripple::base_uint::size
constexpr static std::size_t size()
Definition: base_uint.h:519
ripple::Section::append
void append(std::vector< std::string > const &lines)
Append a set of lines to this section.
Definition: BasicConfig.cpp:38
stdexcept
ripple::base_uint< 256 >
ripple::NodeStore::make_Backend
std::unique_ptr< Backend > make_Backend(Section const &config, Scheduler &scheduler, beast::Journal journal)
Definition: Timing_test.cpp:53
ripple::Section::end
const_iterator end() const
Definition: BasicConfig.h:196
ripple::NodeStore::rngcpy
static void rngcpy(void *buffer, std::size_t bytes, Generator &g)
Definition: Timing_test.cpp:65
thread
ripple::NodeStore::Timing_test::do_tests
void do_tests(std::size_t threads, test_list const &tests, std::vector< std::string > const &config_strings)
Definition: Timing_test.cpp:690
ripple::NodeStore::Timing_test::parallel_for
void parallel_for(std::size_t const n, std::size_t number_of_threads, Args const &... args)
Definition: Timing_test.cpp:235
ripple::NodeStore::BEAST_DEFINE_TESTSUITE_MANUAL_PRIO
BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(Timing, NodeStore, ripple, 1)
ripple::NodeStore::Timing_test::do_mixed
void do_mixed(Section const &config, Params const &params, beast::Journal journal)
Definition: Timing_test.cpp:470
ripple::NodeStore::Sequence::obj
std::shared_ptr< NodeObject > obj(std::size_t n)
Definition: Timing_test.cpp:117
chrono
ripple::Rethrow
void Rethrow()
Rethrow the exception currently being handled.
Definition: contract.h:48
ripple::NodeStore::Timing_test::do_work
void do_work(Section const &config, Params const &params, beast::Journal journal)
Definition: Timing_test.cpp:562
ripple::megabytes
constexpr auto megabytes(T value) noexcept
Definition: ByteUtilities.h:34
beast::detail::xor_shift_engine::seed
void seed(result_type seed)
Definition: xor_shift_engine.h:74
ripple::NodeStore::Sequence::prefix_
std::uint8_t prefix_
Definition: Timing_test.cpp:91
std::vector::erase
T erase(T... args)
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint8_t
atomic
map
ripple::NodeStore::Scheduler
Scheduling for asynchronous backend activity.
Definition: ripple/nodestore/Scheduler.h:60
ripple::NodeStore::Timing_test::do_missing
void do_missing(Section const &config, Params const &params, beast::Journal journal)
Definition: Timing_test.cpp:397
ripple::NodeStore::Sequence::Sequence
Sequence(std::uint8_t prefix)
Definition: Timing_test.cpp:96
ripple::test::SuiteJournal
Definition: SuiteJournal.h:88
beast::temp_dir::path
std::string path() const
Get the native path for the temporary directory.
Definition: temp_dir.h:66
ripple::NodeStore::Sequence::key
uint256 key(std::size_t n)
Definition: Timing_test.cpp:107
ripple::NodeStore::Timing_test::Params
Definition: Timing_test.cpp:161
std::vector::emplace_back
T emplace_back(T... args)
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::NodeStore::Timing_test::Params::items
std::size_t items
Definition: Timing_test.cpp:163
ripple::Section::set
void set(std::string const &key, std::string const &value)
Set a key/value pair.
Definition: BasicConfig.cpp:32
std::endl
T endl(T... args)
ripple::NodeStore::Manager::make_Backend
virtual std::unique_ptr< Backend > make_Backend(Section const &parameters, std::size_t burstSize, Scheduler &scheduler, beast::Journal journal)=0
Create a backend.
ripple::base_uint::begin
iterator begin()
Definition: base_uint.h:133
std::left
T left(T... args)
limits
ripple::NodeStore::Timing_test::parse
static Section parse(std::string s)
Definition: Timing_test.cpp:186
std::vector::begin
T begin(T... args)
ripple::NodeStore::isSame
bool isSame(std::shared_ptr< NodeObject > const &lhs, std::shared_ptr< NodeObject > const &rhs)
Returns true if objects are identical.
Definition: TestBase.h:57
ripple::NodeStore::Sequence::maxSize
@ maxSize
Definition: Timing_test.cpp:88
ripple::NodeStore::Timing_test::to_string
static std::string to_string(duration_type const &d)
Definition: Timing_test.cpp:178
std::chrono::milliseconds::count
T count(T... args)
std::fixed
T fixed(T... args)
ripple::NodeStore::Timing_test::parallel_for_lambda::parallel_for_lambda
parallel_for_lambda(std::size_t n, std::atomic< std::size_t > &c)
Definition: Timing_test.cpp:207
ripple::NodeStore::Timing_test::test_func
void(Timing_test::*)(Section const &, Params const &, beast::Journal) test_func
Definition: Timing_test.cpp:673
ripple::NodeStore::Timing_test::parallel_for_lambda::n_
const std::size_t n_
Definition: Timing_test.cpp:203
std::stringstream::str
T str(T... args)
std::size_t
ripple::NodeStore::Sequence::gen_
beast::xor_shift_engine gen_
Definition: Timing_test.cpp:90
beast::detail::xor_shift_engine
Definition: xor_shift_engine.h:32
ripple::NodeStore::Timing_test::run
void run() override
Definition: Timing_test.cpp:737
std::vector::end
T end(T... args)
ripple::NodeStore::Timing_test
Definition: Timing_test.cpp:143
std::setw
T setw(T... args)
ripple::NodeStore::Timing_test::Params::threads
std::size_t threads
Definition: Timing_test.cpp:164
ripple::NodeStore::Manager::instance
static Manager & instance()
Returns the instance of the manager singleton.
Definition: ManagerImp.cpp:120
ripple::NodeStore::Timing_test::default_items
const std::size_t default_items
Definition: Timing_test.cpp:153
std::unique_ptr
STL class.
ripple::NodeStore::Timing_test::do_test
duration_type do_test(test_func f, Section const &config, Params const &params, beast::Journal journal)
Definition: Timing_test.cpp:677
ripple::NodeStore::Backend::fetch
virtual Status fetch(void const *key, std::shared_ptr< NodeObject > *pObject)=0
Fetch a single object.
type_traits
ripple::NodeStore::Timing_test::parallel_for_lambda
Definition: Timing_test.cpp:200
beast::temp_dir
RAII temporary directory.
Definition: temp_dir.h:33
std::ref
T ref(T... args)
std::exception::what
T what(T... args)
ripple::get
T & get(EitherAmount &amt)
Definition: AmountSpec.h:118
ripple::NodeStore::Timing_test::parallel_for_id
void parallel_for_id(std::size_t const n, std::size_t number_of_threads, Args const &... args)
Definition: Timing_test.cpp:251
ripple::NodeStore::Backend
A backend used for the NodeStore.
Definition: Backend.h:39
std::chrono::steady_clock::now
T now(T... args)