memfile_ubench.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #include <string>
  15. #include <fstream>
  16. #include <vector>
  17. #include <boost/shared_ptr.hpp>
  18. #include "benchmark.h"
  19. struct Lease4 {
  20. uint32_t addr;
  21. std::vector<uint8_t> hwaddr;
  22. std::vector<uint8_t> client_id;
  23. uint32_t valid_lft;
  24. uint32_t recycle_time;
  25. time_t cltt;
  26. uint32_t pool_id;
  27. bool fixed;
  28. std::string hostname;
  29. bool fqdn_fwd;
  30. bool fqdn_rev;
  31. std::string options;
  32. std::string comments;
  33. };
  34. typedef boost::shared_ptr<Lease4> Lease4Ptr;
  35. class memfile_LeaseMgr;
  36. class memfile_uBenchmark: public uBenchmark {
  37. public:
  38. memfile_uBenchmark(const std::string& filename,
  39. uint32_t num_iterations, bool sync, bool verbose);
  40. virtual void printInfo();
  41. virtual void connect();
  42. virtual void disconnect();
  43. virtual void createLease4Test();
  44. virtual void searchLease4Test();
  45. virtual void updateLease4Test();
  46. virtual void deleteLease4Test();
  47. protected:
  48. void failure(const char* operation);
  49. memfile_LeaseMgr * LeaseMgr_;
  50. std::string Filename_;
  51. };