trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z..@apache.org
Subject git commit: TS-2200: define macro TS_HRTIME_XXX directly
Date Thu, 31 Oct 2013 11:03:14 GMT
Updated Branches:
  refs/heads/master 1ab59b435 -> e75d33a39


TS-2200: define macro TS_HRTIME_XXX directly

   old macro defines can NOT be used in plugin because the target macros
   defined in lib/ts/ink_hrtime.h


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

Branch: refs/heads/master
Commit: e75d33a39fd94ae0942714201d875876cec574f4
Parents: 1ab59b4
Author: Yu Qing <zhuangyuan@taobao.com>
Authored: Tue Sep 3 10:52:49 2013 +0800
Committer: Zhao Yongming <ming.zym@gmail.com>
Committed: Thu Oct 31 19:02:36 2013 +0800

----------------------------------------------------------------------
 CHANGES                     |  3 +++
 proxy/api/ts/experimental.h | 46 ++++++++++++++++++++--------------------
 2 files changed, 26 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e75d33a3/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index f84b13c..74c5771 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
 Changes with Apache Traffic Server 4.1.0
 
 
+  *) [TS-2200] TS_HRTIME_xxx in experimental.h is invalid to use.
+   Author: Yu Qing
+
   *) [TS-2235] url_print should NOT output "?" for empty query string.
    Author: Yu Qing
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e75d33a3/proxy/api/ts/experimental.h
----------------------------------------------------------------------
diff --git a/proxy/api/ts/experimental.h b/proxy/api/ts/experimental.h
index 75037a2..e8d10f7 100644
--- a/proxy/api/ts/experimental.h
+++ b/proxy/api/ts/experimental.h
@@ -110,20 +110,20 @@ extern "C"
   tsapi void TSHttpTxnServerRequestBodySet(TSHttpTxn txnp, char *buf, int64_t buflength);
 
   /* ===== High Resolution Time ===== */
-#define TS_HRTIME_FOREVER  HRTIME_FOREVER
-#define TS_HRTIME_DECADE   HRTIME_DECADE
-#define TS_HRTIME_YEAR     HRTIME_YEAR
-#define TS_HRTIME_WEEK     HRTIME_WEEK
-#define TS_HRTIME_DAY      HRTIME_DAY
-#define TS_HRTIME_HOUR     HRTIME_HOUR
-#define TS_HRTIME_MINUTE   HRTIME_MINUTE
-#define TS_HRTIME_SECOND   HRTIME_SECOND
-#define TS_HRTIME_MSECOND  HRTIME_MSECOND
-#define TS_HRTIME_USECOND  HRTIME_USECOND
-#define TS_HRTIME_NSECOND  HRTIME_NSECOND
-
-#define TS_HRTIME_APPROX_SECONDS(_x) HRTIME_APPROX_SECONDS(_x)
-#define TS_HRTIME_APPROX_FACTOR      HRTIME_APPROX_FACTOR
+#define TS_HRTIME_FOREVER  (10*TS_HRTIME_DECADE)
+#define TS_HRTIME_DECADE   (10*TS_HRTIME_YEAR)
+#define TS_HRTIME_YEAR     (365*TS_HRTIME_DAY+TS_HRTIME_DAY/4)
+#define TS_HRTIME_WEEK     (7*TS_HRTIME_DAY)
+#define TS_HRTIME_DAY      (24*TS_HRTIME_HOUR)
+#define TS_HRTIME_HOUR     (60*TS_HRTIME_MINUTE)
+#define TS_HRTIME_MINUTE   (60*TS_HRTIME_SECOND)
+#define TS_HRTIME_SECOND   (1000*TS_HRTIME_MSECOND)
+#define TS_HRTIME_MSECOND  (1000*TS_HRTIME_USECOND)
+#define TS_HRTIME_USECOND  (1000*TS_HRTIME_NSECOND)
+#define TS_HRTIME_NSECOND  (1LL)
+
+#define TS_HRTIME_APPROX_SECONDS(_x) ((_x)>>30)    // off by 7.3%
+#define TS_HRTIME_APPROX_FACTOR      (((float)(1<<30))/(((float)HRTIME_SECOND)))
 
   /*
 ////////////////////////////////////////////////////////////////////
@@ -132,15 +132,15 @@ extern "C"
 //
 ////////////////////////////////////////////////////////////////////
 */
-#define TS_HRTIME_YEARS(_x)    HRTIME_YEARS(_x)
-#define TS_HRTIME_WEEKS(_x)    HRTIME_WEEKS(_x)
-#define TS_HRTIME_DAYS(_x)     HRTIME_DAYS(_x)
-#define TS_HRTIME_HOURS(_x)    HRTIME_HOURS(_x)
-#define TS_HRTIME_MINUTES(_x)  HRTIME_MINUTES(_x)
-#define TS_HRTIME_SECONDS(_x)  HRTIME_SECONDS(_x)
-#define TS_HRTIME_MSECONDS(_x) HRTIME_MSECONDS(_x)
-#define TS_HRTIME_USECONDS(_x) HRTIME_USECONDS(_x)
-#define TS_HRTIME_NSECONDS(_x) HRTIME_NSECONDS(_x)
+#define TS_HRTIME_YEARS(_x)    ((_x)*TS_HRTIME_YEAR)
+#define TS_HRTIME_WEEKS(_x)    ((_x)*TS_HRTIME_WEEK)
+#define TS_HRTIME_DAYS(_x)     ((_x)*TS_HRTIME_DAY)
+#define TS_HRTIME_HOURS(_x)    ((_x)*TS_HRTIME_HOUR)
+#define TS_HRTIME_MINUTES(_x)  ((_x)*TS_HRTIME_MINUTE)
+#define TS_HRTIME_SECONDS(_x)  ((_x)*TS_HRTIME_SECOND)
+#define TS_HRTIME_MSECONDS(_x) ((_x)*TS_HRTIME_MSECOND)
+#define TS_HRTIME_USECONDS(_x) ((_x)*TS_HRTIME_USECOND)
+#define TS_HRTIME_NSECONDS(_x) ((_x)*TS_HRTIME_NSECOND)
 
   tsapi TSReturnCode TSHttpTxnCachedRespTimeGet(TSHttpTxn txnp, time_t *resp_time);
 


Mime
View raw message