diff options
author | Hyotaek Shim <hyotaek.shim@samsung.com> | 2020-12-11 10:29:02 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@review> | 2020-12-11 10:29:02 +0000 |
commit | bd385559758373a7e0c320fb81e2fc1d4714e6dd (patch) | |
tree | 9d54be21f28186384612f7e6182943e142a86c80 | |
parent | 3fa6c844dabfcbdee947eb558f526c889965b444 (diff) | |
parent | 55af0a46c935aabc7e8bfcd6822135910fc75085 (diff) | |
download | libdbuspolicy-bd385559758373a7e0c320fb81e2fc1d4714e6dd.tar.gz libdbuspolicy-bd385559758373a7e0c320fb81e2fc1d4714e6dd.tar.bz2 libdbuspolicy-bd385559758373a7e0c320fb81e2fc1d4714e6dd.zip |
Merge "tests: allow reading from file in perf test" into tizensubmit/tizen/20201211.104319accepted/tizen/unified/20201214.124456
-rw-r--r-- | src/stest_performance.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/stest_performance.cpp b/src/stest_performance.cpp index 1fe6635..bda50f8 100644 --- a/src/stest_performance.cpp +++ b/src/stest_performance.cpp @@ -208,16 +208,17 @@ void run_x_times(std::function<void(void)> func, size_t times) { 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) @@ -226,8 +227,8 @@ void run_fb(const char *conf_file, bool verify, size_t count, bool 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) { @@ -248,13 +249,14 @@ int main(int argc, char *argv[]) { 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) { @@ -271,6 +273,9 @@ int main(int argc, char *argv[]) case 'w': worst = true; break; + case 'i': + input_filename_serialized = optarg; + break; } } @@ -282,7 +287,7 @@ int main(int argc, char *argv[]) } 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; } |