diff Core/HttpClient.cpp @ 3516:96780208dbd7

reporting timings in HttpClient
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 11 Sep 2019 13:21:50 +0200
parents 6add197274b1
children d5740d3b1d67
line wrap: on
line diff
--- a/Core/HttpClient.cpp	Tue Sep 03 10:34:26 2019 +0200
+++ b/Core/HttpClient.cpp	Wed Sep 11 13:21:50 2019 +0200
@@ -933,6 +933,8 @@
 
     CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_WRITEDATA, &answer));
 
+    const boost::posix_time::ptime start = boost::posix_time::microsec_clock::universal_time();
+    
     if (boost::starts_with(url_, "https://"))
     {
       code = OrthancHttpClientPerformSSL(pimpl_->curl_, &status);
@@ -942,7 +944,10 @@
       code = GetHttpStatus(curl_easy_perform(pimpl_->curl_), pimpl_->curl_, &status);
     }
 
-    LOG(INFO) << "HTTP status code " << status << " after "
+    const boost::posix_time::ptime end = boost::posix_time::microsec_clock::universal_time();
+    
+    LOG(INFO) << "HTTP status code " << status << " in "
+              << ((end - start).total_milliseconds()) << " ms after "
               << EnumerationToString(method_) << " request on: " << url_;
 
     if (isVerbose_)