In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "how to get all kinds of response time of the site". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought. Let's study and learn "how to get all kinds of response time of the site"!
Sometimes, in order to test the network, you need to return the time spent in each phase, such as the time spent parsing DNS, the time it takes to establish a connection, the time it takes from establishing the connection to preparing for transmission, the time from establishing the connection to the start of the transmission, the whole process, the amount of data downloaded, the download speed, the amount of data uploaded, the upload speed, and so on. The following script gets the above information:
The code is as follows:
# #
# author: www.ttlsa.com #
# QQ group: 39514058 #
# E-mail: service@ttlsa.com #
# #
Use strict
Use Data::Dumper
Use WWW::Curl::Easy
If (! @ ARGV) {
Print "Usaging: $0 url\ n"
Print "For example: $0 www.ttlsa.com\ n"
Exit
}
My $curl = new WWW::Curl::Easy
Open my $response_body, "> / dev/null"
$curl- > setopt (CURLOPT_HEADER,1)
$curl- > setopt (CURLOPT_URL, $ARGV [0])
$curl- > setopt (CURLOPT_WRITEDATA,\ $response_body)
$curl- > perform
My $err = $curl- > errbuf
If (! $err) {
My $st = & getTime
My $http_code = $curl- > getinfo (CURLINFO_RESPONSE_CODE)
My $http_dns_time = $curl- > getinfo (CURLINFO_NAMELOOKUP_TIME)
My $http_conn_time = $curl- > getinfo (CURLINFO_CONNECT_TIME)
# my $http_APP_time = $curl- > getinfo (CURLINFO_APPCONNECT_TIME)
My $http_PRE_TRAN_time = $curl- > getinfo (CURLINFO_PRETRANSFER_TIME)
My $http_START_TRAN_time = $curl- > getinfo (CURLINFO_STARTTRANSFER_TIME)
My $http_TOTAL_time = $curl- > getinfo (CURLINFO_TOTAL_TIME)
My $http_SIZE_DOWN = $curl- > getinfo (CURLINFO_SIZE_DOWNLOAD)
My $http_SPEED_DOWN = $curl- > getinfo (CURLINFO_SPEED_DOWNLOAD)
Printf "local_time:% s, http_code:% d, dns_time:% .3fms, conn_time:% .3fms, pre_tran_time:% .3fms, start_tran_time:% .3fms, total_time:% .3fms, size_download:% dB, speed_download:% dB/s", ($st,$http_code,$http_dns_time,$http_conn_time,$http_PRE_TRAN_time,$http_START_TRAN_time,$http_TOTAL_time $http_SIZE_DOWN,$http_SPEED_DOWN)
Write
Format STDOUT_TOP=
Details of various response times of the site-@ | |
$%
=
+- -+
| | Local time | status | DNS resolution time | connection establishment time | time from connection establishment to preparation for transmission | time from connection establishment to start transmission | whole process time | amount of downloaded data | average download speed | |
+- -+
.
Format STDOUT=
| @
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.