From b75accc0b819ee0b9ae9807758243c5a3c5f96b9 Mon Sep 17 00:00:00 2001 From: Jiri Vlasak Date: Tue, 26 Feb 2019 16:30:44 +0100 Subject: [PATCH] Add global time measurement to main --- base/main.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/base/main.cc b/base/main.cc index 5e710b3..c9e0f95 100644 --- a/base/main.cc +++ b/base/main.cc @@ -50,8 +50,18 @@ along with I am car. If not, see . std::chrono::high_resolution_clock::time_point TSTART_; std::chrono::high_resolution_clock::time_point TEND_; +float TELAPSED = 0; +float ELAPSED = 0; void TSTART() {TSTART_ = std::chrono::high_resolution_clock::now();} -void TEND() {TEND_ = std::chrono::high_resolution_clock::now();} +void TEND() { + std::chrono::duration DT_; + TEND_ = std::chrono::high_resolution_clock::now(); + DT_ = std::chrono::duration_cast>( + TEND_ - TSTART_ + ); + TELAPSED += DT_.count(); + ELAPSED = DT_.count(); +} void TPRINT(const char *what) { std::chrono::duration DT_; DT_ = std::chrono::duration_cast>( @@ -153,6 +163,7 @@ int main() if (ps.slot().bnodes().size() > 0) ps.fpose(); TEND(); + jvo["ppse"] = ELAPSED; TPRINT("ParallelSlot"); if (ps.cusp().size() > 0) { @@ -326,11 +337,13 @@ escapeloop: #endif TEND(); TPRINT("RRT"); + jvo["rrte"] = ELAPSED; #ifdef JSONLOGEDGES p.logr(p.root()); #endif // statistics to error output + std::cerr << "TELAPSED is " << TELAPSED << std::endl; std::cerr << "Elapsed is " << p.elapsed() << std::endl; std::cerr << "Goal found is " << p.goal_found() << std::endl; std::cerr << "#nodes is " << p.nodes().size() << std::endl; @@ -351,7 +364,7 @@ escapeloop: std::cerr << "- " << edges.size() << std::endl; // JSON output - jvo["elap"] = p.elapsed(); + jvo["elap"] = TELAPSED; #ifdef USE_PTHREAD jvo["nodo"][0] = nodo; #endif -- 2.39.2