trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bc...@apache.org
Subject [1/2] trafficserver git commit: TS-3507: Add stats for the milestones
Date Wed, 08 Apr 2015 18:49:36 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master e3bd929bb -> ca83b34cf


TS-3507: Add stats for the milestones


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

Branch: refs/heads/master
Commit: 77cb386d331c5a5a146de80fb0d6c536974b936b
Parents: e3bd929
Author: Bryan Call <bcall@apache.org>
Authored: Wed Apr 8 11:44:27 2015 -0700
Committer: Bryan Call <bcall@apache.org>
Committed: Wed Apr 8 11:44:27 2015 -0700

----------------------------------------------------------------------
 proxy/StatSystem.cc        | 18 ++++++++++
 proxy/StatSystem.h         |  8 +++++
 proxy/http/HttpConfig.cc   | 42 ++++++++++++++++++++++
 proxy/http/HttpConfig.h    | 22 ++++++++++++
 proxy/http/HttpSM.cc       | 32 +++--------------
 proxy/http/HttpTransact.cc | 77 +++++++++++++++++++++++++++++++++++++++--
 proxy/http/HttpTransact.h  |  2 +-
 7 files changed, 169 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/77cb386d/proxy/StatSystem.cc
----------------------------------------------------------------------
diff --git a/proxy/StatSystem.cc b/proxy/StatSystem.cc
index 4a4b7a0..391cdd8 100644
--- a/proxy/StatSystem.cc
+++ b/proxy/StatSystem.cc
@@ -731,3 +731,21 @@ http_trans_stats_time_useconds_cb(void *data, void *res)
   *(float *)res = r;
   return res;
 }
+
+int64_t
+milestone_difference_msec(const ink_hrtime start, const ink_hrtime end)
+{
+  if (end == 0) {
+    return -1;
+  }
+  return (end - start) / 1000000;
+}
+
+double
+milestone_difference(const ink_hrtime start, const ink_hrtime end)
+{
+  if (end == 0) {
+    return -1;
+  }
+  return (double)(end - start) / 1000000000;
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/77cb386d/proxy/StatSystem.h
----------------------------------------------------------------------
diff --git a/proxy/StatSystem.h b/proxy/StatSystem.h
index 4144b76..401acec 100644
--- a/proxy/StatSystem.h
+++ b/proxy/StatSystem.h
@@ -104,6 +104,14 @@ public:
   // ink_hrtime  cache_write_end;
 };
 
+/**
+ * Takes two milestones and returns the difference.
+ * @param start The start time
+ * @param end The end time
+ * @return A double that is the time in seconds
+ */
+double milestone_difference(const ink_hrtime start, const ink_hrtime end);
+int64_t milestone_difference_msec(const ink_hrtime start, const ink_hrtime end);
 
 // Modularization Project: Build w/o thread-local-dyn-stats
 // temporarily until we switch over to librecords.  Revert to old

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/77cb386d/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index ef3089f..a5bfc63 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -854,6 +854,48 @@ register_stat_callbacks()
                      (int)https_incoming_requests_stat, RecRawStatSyncCount);
   RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.https.total_client_connections",
RECD_COUNTER, RECP_PERSISTENT,
                      (int)https_total_client_connections_stat, RecRawStatSyncCount);
+
+  // milestones
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.ua_begin", RECD_COUNTER,
RECP_PERSISTENT,
+                     (int)http_ua_begin_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.ua_first_read",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_ua_first_read_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.ua_read_header_done",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_ua_read_header_done_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.ua_begin_write",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_ua_begin_write_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.ua_close", RECD_COUNTER,
RECP_PERSISTENT,
+                     (int)http_ua_close_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.server_first_connect",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_server_first_connect_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.server_connect",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_server_connect_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.server_connect_end",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_server_connect_end_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.server_begin_write",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_server_begin_write_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.server_first_read",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_server_first_read_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.server_read_header_done",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_server_read_header_done_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.server_close",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_server_close_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.cache_open_read_begin",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_cache_open_read_begin_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.cache_open_read_end",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_cache_open_read_end_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.cache_open_write_begin",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_cache_open_write_begin_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.cache_open_write_end",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_cache_open_write_end_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.dns_lookup_begin",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_dns_lookup_begin_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.dns_lookup_end",
RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_dns_lookup_end_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.sm_start", RECD_COUNTER,
RECP_PERSISTENT,
+                     (int)http_sm_start_time_stat, RecRawStatSyncSum);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.sm_finish", RECD_COUNTER,
RECP_PERSISTENT,
+                     (int)http_sm_finish_time_stat, RecRawStatSyncSum);
 }
 
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/77cb386d/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 0bab35f..9650c58 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -288,6 +288,28 @@ enum {
   https_incoming_requests_stat,
   https_total_client_connections_stat,
 
+  // milestone timing statistics in milliseconds
+  http_ua_begin_time_stat,
+  http_ua_first_read_time_stat,
+  http_ua_read_header_done_time_stat,
+  http_ua_begin_write_time_stat,
+  http_ua_close_time_stat,
+  http_server_first_connect_time_stat,
+  http_server_connect_time_stat,
+  http_server_connect_end_time_stat,
+  http_server_begin_write_time_stat,
+  http_server_first_read_time_stat,
+  http_server_read_header_done_time_stat,
+  http_server_close_time_stat,
+  http_cache_open_read_begin_time_stat,
+  http_cache_open_read_end_time_stat,
+  http_cache_open_write_begin_time_stat,
+  http_cache_open_write_end_time_stat,
+  http_dns_lookup_begin_time_stat,
+  http_dns_lookup_end_time_stat,
+  http_sm_start_time_stat,
+  http_sm_finish_time_stat,
+
   http_stat_count
 };
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/77cb386d/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 71a97f1..400f733 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -98,30 +98,6 @@ static const int len_100_continue_response = strlen(str_100_continue_response);
 static const char *str_408_request_timeout_response = "HTTP/1.1 408 Request Timeout\r\nConnection:
close\r\n\r\n";
 static const int len_408_request_timeout_response = strlen(str_408_request_timeout_response);
 
-/**
- * Takes two milestones and returns the difference.
- * @param start The start time
- * @param end The end time
- * @return A double that is the time in seconds
- */
-static double
-milestone_difference(const ink_hrtime start, const ink_hrtime end)
-{
-  if (end == 0) {
-    return -1;
-  }
-  return (double)(end - start) / 1000000000;
-}
-
-static double
-milestone_difference_msec(const ink_hrtime start, const ink_hrtime end)
-{
-  if (end == 0) {
-    return -1;
-  }
-  return (double)(end - start) / 1000000;
-}
-
 void
 HttpSM::_make_scatter_list(HttpSM *prototype)
 {
@@ -6655,10 +6631,10 @@ HttpSM::update_stats()
   }
 #endif
 
-  HttpTransact::update_size_and_time_stats(&t_state, total_time, ua_write_time, os_read_time,
client_request_hdr_bytes,
-                                           client_request_body_bytes, client_response_hdr_bytes,
client_response_body_bytes,
-                                           server_request_hdr_bytes, server_request_body_bytes,
server_response_hdr_bytes,
-                                           server_response_body_bytes, pushed_response_hdr_bytes,
pushed_response_body_bytes);
+  HttpTransact::update_size_and_time_stats(
+    &t_state, total_time, ua_write_time, os_read_time, client_request_hdr_bytes, client_request_body_bytes,
+    client_response_hdr_bytes, client_response_body_bytes, server_request_hdr_bytes, server_request_body_bytes,
+    server_response_hdr_bytes, server_response_body_bytes, pushed_response_hdr_bytes, pushed_response_body_bytes,
milestones);
   /*
       if (is_action_tag_set("http_handler_times")) {
           print_all_http_handler_times();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/77cb386d/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index f910e91..3e3794e 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -8647,7 +8647,7 @@ HttpTransact::update_size_and_time_stats(State *s, ink_hrtime total_time,
ink_hr
                                          int64_t user_agent_response_body_size, int origin_server_request_header_size,
                                          int64_t origin_server_request_body_size, int origin_server_response_header_size,
                                          int64_t origin_server_response_body_size, int pushed_response_header_size,
-                                         int64_t pushed_response_body_size)
+                                         int64_t pushed_response_body_size, const TransactionMilestones
&milestones)
 {
   int64_t user_agent_request_size = user_agent_request_header_size + user_agent_request_body_size;
   int64_t user_agent_response_size = user_agent_response_header_size + user_agent_response_body_size;
@@ -8783,10 +8783,81 @@ HttpTransact::update_size_and_time_stats(State *s, ink_hrtime total_time,
ink_hr
     origin_server_connection_speed(s, origin_server_read_time, origin_server_response_size);
   }
 
-  return;
+  printf("%lld\n", milestone_difference_msec(milestones.sm_start, milestones.sm_finish));
+  // update milestones stats
+  if (http_ua_begin_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_ua_begin_time_stat, milestone_difference_msec(milestones.sm_start,
milestones.ua_begin))
+  }
+  if (http_ua_first_read_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_ua_first_read_time_stat, milestone_difference_msec(milestones.sm_start,
milestones.ua_first_read))
+  }
+  if (http_ua_read_header_done_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_ua_read_header_done_time_stat,
+                        milestone_difference_msec(milestones.sm_start, milestones.ua_read_header_done))
+  }
+  if (http_ua_begin_write_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_ua_begin_write_time_stat, milestone_difference_msec(milestones.sm_start,
milestones.ua_begin_write))
+  }
+  if (http_ua_close_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_ua_close_time_stat, milestone_difference_msec(milestones.sm_start,
milestones.ua_close))
+  }
+  if (http_server_first_connect_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_server_first_connect_time_stat,
+                        milestone_difference_msec(milestones.sm_start, milestones.server_first_connect))
+  }
+  if (http_server_connect_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_server_connect_time_stat, milestone_difference_msec(milestones.sm_start,
milestones.server_connect))
+  }
+  if (http_server_connect_end_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_server_connect_end_time_stat,
+                        milestone_difference_msec(milestones.sm_start, milestones.server_connect_end))
+  }
+  if (http_server_begin_write_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_server_begin_write_time_stat,
+                        milestone_difference_msec(milestones.sm_start, milestones.server_begin_write))
+  }
+  if (http_server_first_read_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_server_first_read_time_stat,
+                        milestone_difference_msec(milestones.sm_start, milestones.server_first_read))
+  }
+  if (http_server_read_header_done_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_server_read_header_done_time_stat,
+                        milestone_difference_msec(milestones.sm_start, milestones.server_read_header_done))
+  }
+  if (http_server_close_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_server_close_time_stat, milestone_difference_msec(milestones.sm_start,
milestones.server_close))
+  }
+  if (http_cache_open_read_begin_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_cache_open_read_begin_time_stat,
+                        milestone_difference_msec(milestones.sm_start, milestones.cache_open_read_begin))
+  }
+  if (http_cache_open_read_end_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_cache_open_read_end_time_stat,
+                        milestone_difference_msec(milestones.sm_start, milestones.cache_open_read_end))
+  }
+  if (http_cache_open_write_begin_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_cache_open_write_begin_time_stat,
+                        milestone_difference_msec(milestones.sm_start, milestones.cache_open_write_begin))
+  }
+  if (http_cache_open_write_end_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_cache_open_write_end_time_stat,
+                        milestone_difference_msec(milestones.sm_start, milestones.cache_open_write_end))
+  }
+  if (http_dns_lookup_begin_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_dns_lookup_begin_time_stat,
+                        milestone_difference_msec(milestones.sm_start, milestones.dns_lookup_begin))
+  }
+  if (http_dns_lookup_end_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_dns_lookup_end_time_stat, milestone_difference_msec(milestones.sm_start,
milestones.dns_lookup_end))
+  }
+  if (http_sm_start_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_sm_start_time_stat, milestone_difference_msec(milestones.sm_start,
milestones.sm_start))
+  }
+  if (http_sm_finish_time_stat) {
+    HTTP_SUM_TRANS_STAT(http_sm_finish_time_stat, milestone_difference_msec(milestones.sm_start,
milestones.sm_finish))
+  }
 }
 
-
 // void HttpTransact::add_new_stat_block(State* s)
 //
 //   Adds a new stat block

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/77cb386d/proxy/http/HttpTransact.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
index e598951..bfff451 100644
--- a/proxy/http/HttpTransact.h
+++ b/proxy/http/HttpTransact.h
@@ -1245,7 +1245,7 @@ public:
                                          int64_t user_agent_response_body_size, int origin_server_request_header_size,
                                          int64_t origin_server_request_body_size, int origin_server_response_header_size,
                                          int64_t origin_server_response_body_size, int pushed_response_header_size,
-                                         int64_t pushed_response_body_size);
+                                         int64_t pushed_response_body_size, const TransactionMilestones
&milestones);
   static void histogram_request_document_size(State *s, int64_t size);
   static void histogram_response_document_size(State *s, int64_t size);
   static void user_agent_connection_speed(State *s, ink_hrtime transfer_time, int64_t nbytes);


Mime
View raw message