trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bc...@apache.org
Subject trafficserver git commit: TS-3961: Open source Yahoo's ats-multiplexer plug-in Changed clock_gettime to gettimeofday for OSX
Date Mon, 26 Oct 2015 21:54:24 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 53d386c24 -> 09acc0b81


TS-3961: Open source Yahoo's ats-multiplexer plug-in
Changed clock_gettime to gettimeofday for OSX


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/09acc0b8
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/09acc0b8
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/09acc0b8

Branch: refs/heads/master
Commit: 09acc0b81d9511433b40bef63ab0ed7ce000ce85
Parents: 53d386c
Author: Bryan Call <bcall@apache.org>
Authored: Mon Oct 26 14:53:54 2015 -0700
Committer: Bryan Call <bcall@apache.org>
Committed: Mon Oct 26 14:53:54 2015 -0700

----------------------------------------------------------------------
 plugins/experimental/multiplexer/dispatch.cc | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/09acc0b8/plugins/experimental/multiplexer/dispatch.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/multiplexer/dispatch.cc b/plugins/experimental/multiplexer/dispatch.cc
index 44bb6f5..35bb2ba 100644
--- a/plugins/experimental/multiplexer/dispatch.cc
+++ b/plugins/experimental/multiplexer/dispatch.cc
@@ -21,6 +21,7 @@
   limitations under the License.
  */
 #include <inttypes.h>
+#include <sys/time.h>
 
 #include "dispatch.h"
 #include "fetcher.h"
@@ -109,7 +110,7 @@ read(const TSIOBuffer &b, std::string &o, const int64_t l = 0)
 class Handler
 {
   int64_t length;
-  struct timespec start;
+  struct timeval start;
   std::string response;
 
 public:
@@ -119,7 +120,7 @@ public:
   {
     assert(!u.empty());
     const_cast<std::string &>(url).swap(u);
-    clock_gettime(CLOCK_MONOTONIC, &start);
+    gettimeofday(&start, NULL);
   }
 
   void
@@ -164,15 +165,15 @@ public:
   void
   done(void)
   {
-    struct timespec end;
+    struct timeval end;
 
-    clock_gettime(CLOCK_MONOTONIC, &end);
+    gettimeofday(&end, NULL);
 
     if (TSIsDebugTagSet(PLUGIN_TAG) > 0) {
       TSDebug(PLUGIN_TAG, "Response for \"%s\" was:\n%s", url.c_str(), response.c_str());
     }
 
-    const long diff = (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_nsec - start.tv_nsec)
/ 1000;
+    const long diff = (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_usec - start.tv_usec);
 
     TSStatIntIncrement(statistics.hits, 1);
     TSStatIntIncrement(statistics.time, diff);


Mime
View raw message