MCPcopy Create free account
hub / github.com/apache/trafficserver / update_stats

Method update_stats

src/proxy/http/HttpSM.cc:7650–7800  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7648}
7649
7650void
7651HttpSM::update_stats()
7652{
7653 ATS_PROBE1(milestone_sm_finish, sm_id);
7654 milestones[TS_MILESTONE_SM_FINISH] = ink_get_hrtime();
7655
7656 if (is_action_tag_set("bad_length_state_dump")) {
7657 if (t_state.hdr_info.client_response.valid() && t_state.hdr_info.client_response.status_get() == HTTP_STATUS_OK) {
7658 int64_t p_resp_cl = t_state.hdr_info.client_response.get_content_length();
7659 int64_t resp_size = client_response_body_bytes;
7660 if (!((p_resp_cl == -1 || p_resp_cl == resp_size || resp_size == 0))) {
7661 Error("[%" PRId64 "] Truncated content detected", sm_id);
7662 dump_state_on_assert();
7663 }
7664 } else if (client_request_hdr_bytes == 0) {
7665 Error("[%" PRId64 "] Zero length request header received", sm_id);
7666 dump_state_on_assert();
7667 }
7668 }
7669
7670 ink_hrtime total_time = milestones.elapsed(TS_MILESTONE_SM_START, TS_MILESTONE_SM_FINISH);
7671
7672 // ua_close will not be assigned properly in some exceptional situation.
7673 // TODO: Assign ua_close with suitable value when HttpTunnel terminates abnormally.
7674 if (milestones[TS_MILESTONE_UA_CLOSE] == 0 && milestones[TS_MILESTONE_UA_READ_HEADER_DONE] > 0) {
7675 ATS_PROBE1(milestone_ua_close, sm_id);
7676 milestones[TS_MILESTONE_UA_CLOSE] = ink_get_hrtime();
7677 }
7678
7679 // request_process_time = The time after the header is parsed to the completion of the transaction
7680 ink_hrtime request_process_time = milestones[TS_MILESTONE_UA_CLOSE] - milestones[TS_MILESTONE_UA_READ_HEADER_DONE];
7681
7682 HttpTransact::client_result_stat(&t_state, total_time, request_process_time);
7683
7684 ink_hrtime ua_write_time;
7685 if (milestones[TS_MILESTONE_UA_BEGIN_WRITE] != 0 && milestones[TS_MILESTONE_UA_CLOSE] != 0) {
7686 ua_write_time = milestones.elapsed(TS_MILESTONE_UA_BEGIN_WRITE, TS_MILESTONE_UA_CLOSE);
7687 } else {
7688 ua_write_time = -1;
7689 }
7690
7691 ink_hrtime os_read_time;
7692 if (milestones[TS_MILESTONE_SERVER_READ_HEADER_DONE] != 0 && milestones[TS_MILESTONE_SERVER_CLOSE] != 0) {
7693 os_read_time = milestones.elapsed(TS_MILESTONE_SERVER_READ_HEADER_DONE, TS_MILESTONE_SERVER_CLOSE);
7694 } else {
7695 os_read_time = -1;
7696 }
7697
7698 HttpTransact::update_size_and_time_stats(
7699 &t_state, total_time, ua_write_time, os_read_time, client_request_hdr_bytes, client_request_body_bytes,
7700 client_response_hdr_bytes, client_response_body_bytes, server_request_hdr_bytes, server_request_body_bytes,
7701 server_response_hdr_bytes, server_response_body_bytes, pushed_response_hdr_bytes, pushed_response_body_bytes, milestones);
7702 /*
7703 if (is_action_tag_set("http_handler_times")) {
7704 print_all_http_handler_times();
7705 }
7706 */
7707

Callers

nothing calls this directly

Calls 15

ink_get_hrtimeFunction · 0.85
ink_hrtime_from_msecFunction · 0.85
get_content_lengthMethod · 0.80
url_printMethod · 0.80
get_txnMethod · 0.80
difference_secMethod · 0.80
ErrorClass · 0.50
memcpyFunction · 0.50
ats_ip_ntopFunction · 0.50
validMethod · 0.45
status_getMethod · 0.45
elapsedMethod · 0.45

Tested by

no test coverage detected