]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/commitdiff
Add global time measurement to main
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Tue, 26 Feb 2019 15:30:44 +0000 (16:30 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Mon, 4 Mar 2019 16:25:14 +0000 (17:25 +0100)
base/main.cc

index 5e710b31b46cf32f737bdf6edfcd747a83ddbe0a..c9e0f95b5fefa5a4d9dc713e0e032d609f752bd2 100644 (file)
@@ -50,8 +50,18 @@ along with I am car. If not, see <http://www.gnu.org/licenses/>.
 
 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<float> DT_;
+        TEND_ = std::chrono::high_resolution_clock::now();
+        DT_ = std::chrono::duration_cast<std::chrono::duration<float>>(
+                TEND_ - TSTART_
+        );
+        TELAPSED += DT_.count();
+        ELAPSED = DT_.count();
+}
 void TPRINT(const char *what) {
         std::chrono::duration<float> DT_;
         DT_ = std::chrono::duration_cast<std::chrono::duration<float>>(
@@ -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