[mapguide-commits] r9694 - sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Jul 28 10:17:41 PDT 2020


Author: jng
Date: 2020-07-28 10:17:39 -0700 (Tue, 28 Jul 2020)
New Revision: 9694

Modified:
   sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/main.cpp
Log:
Add timings for each logged request

Modified: sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/main.cpp
===================================================================
--- sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/main.cpp	2020-07-28 17:08:20 UTC (rev 9693)
+++ sandbox/jng/ogc_viewer_representation/Web/src/DevHttpServer/main.cpp	2020-07-28 17:17:39 UTC (rev 9694)
@@ -19,6 +19,7 @@
 #include <tclap/CmdLine.h>
 #include <cstdio>
 #include <string>
+#include <chrono>
 
 // for memory leak detection
 #ifdef _WIN32
@@ -357,6 +358,7 @@
 {
     std::string logStr;
     bool bLoggedStatus = false;
+    auto tStart = std::chrono::steady_clock::now();
 
     bool isGet = req.method == "GET";
     bool isPost = req.method == "POST";
@@ -447,7 +449,10 @@
         }
     }
 
-    printf("%s\n", logStr.c_str());
+    auto tEnd = std::chrono::steady_clock::now();
+    auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(tEnd - tStart).count();
+
+    printf("%s (%dms)\n", logStr.c_str(), duration);
 }
 
 void MapAgentHandlerWithContentReader(const httplib::Request& req, httplib::Response& res, const httplib::ContentReader& content_reader)



More information about the mapguide-commits mailing list