diff options
-rw-r--r-- | scripts/thr_hist.py | 6 | ||||
-rw-r--r-- | src/hotstuff_client.cpp | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/scripts/thr_hist.py b/scripts/thr_hist.py index b6ef40a..6f385e5 100644 --- a/scripts/thr_hist.py +++ b/scripts/thr_hist.py @@ -39,8 +39,9 @@ if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--interval', type=float, default=1, required=False) parser.add_argument('--output', type=str, default="hist.png", required=False) + parser.add_argument('--plot', action='store_true') args = parser.parse_args() - commit_pat = re.compile('([^[].*) \[hotstuff info\] ([0-9.]*) [0-9.]*$') + commit_pat = re.compile('([^[].*) \[hotstuff info\] ([0-9.]*)$') interval = args.interval begin_time = None next_begin_time = None @@ -68,4 +69,5 @@ if __name__ == '__main__': print("lat = {:.3f}ms".format(sum(lats) / len(lats) * 1e3)) lats, _ = remove_outliers(lats) print("lat = {:.3f}ms".format(sum(lats) / len(lats) * 1e3)) - plot_thr(args.output) + if args.plot: + plot_thr(args.output) diff --git a/src/hotstuff_client.cpp b/src/hotstuff_client.cpp index 31c6c0a..390149f 100644 --- a/src/hotstuff_client.cpp +++ b/src/hotstuff_client.cpp @@ -102,7 +102,6 @@ void client_resp_cmd_handler(MsgRespCmd &&msg, MsgNetwork<opcode_t>::Conn &) { struct timeval tv; gettimeofday(&tv, nullptr); elapsed.push_back(std::make_pair(tv, et.elapsed_sec)); - //HOTSTUFF_LOG_INFO("%.6f %.6f", et.elapsed_sec, et.cpu_elapsed_sec); #endif waiting.erase(it); try_send(); @@ -165,6 +164,7 @@ int main(int argc, char **argv) { eb.dispatch(); } catch (HotStuffError &e) { HOTSTUFF_LOG_ERROR("exception: %s", std::string(e).c_str()); +#ifdef HOTSTUFF_ENABLE_BENCHMARK for (const auto &e: elapsed) { char fmt[64]; @@ -172,6 +172,7 @@ int main(int argc, char **argv) { strftime(fmt, sizeof fmt, "%Y-%m-%d %H:%M:%S.%%06u [hotstuff info] %%.6f\n", tmp); fprintf(stderr, fmt, e.first.tv_usec, e.second); } +#endif } return 0; } |