std::cout << "run: " << static_cast<double>(end - begin)/CLOCKS_PER_SEC << std::endl;
}
-void run_fb(const char *conf_file, bool verify, size_t count, bool worst) {
+void run_fb(const char *conf_file, const std::string &serialized, bool verify, size_t count, bool worst) {
Serializer serializer;
- size_t size;
- auto buff = serializer.serialize(conf_file, size);
-
- if (verify)
- std::cerr << "verification not supported at the moment" << std::endl;
StorageBackendSerialized storage;
- storage.initFromData(buff, size);
+ if (serialized.empty()) {
+ size_t size;
+ auto buff = serializer.serialize(conf_file, size);
+ storage.initFromData(buff, size, verify);
+ } else {
+ storage.init(serialized.c_str(), verify);
+ }
printf("SERIALIZED:\n");
if (!worst)
run_x_times([&storage](){ send_prefix_test(storage, test_send_to_nonexistent); }, count);
}
-void run_tests(const char *conf_file, bool verify, size_t c, bool worst) {
- run_fb(conf_file, verify, c, worst);
+void run_tests(const char *conf_file, const std::string &serialized, bool verify, size_t c, bool worst) {
+ run_fb(conf_file, serialized, verify, c, worst);
}
void print_help(const char *name) {
{
int c;
std::string input_filename = system_bus_conf_file_primary();
+ std::string input_filename_serialized;
size_t count = 100;
bool verify = false;
bool worst = false;
while (1) {
int option_index;
- c = getopt_long(argc, argv, "vwc:", options, &option_index);
+ c = getopt_long(argc, argv, "vwc:i:", options, &option_index);
if (c == -1)
break;
switch(c) {
case 'w':
worst = true;
break;
+ case 'i':
+ input_filename_serialized = optarg;
+ break;
}
}
}
tslog::init();
- run_tests(input_filename.c_str(), verify, count, worst);
+ run_tests(input_filename.c_str(), input_filename_serialized, verify, count, worst);
return 0;
}