使用curl命令输出文件的时间戳和延迟

问题描述 投票:2回答:1

我正在使用curl命令来测量日期/时间(或时间戳)以及请求的延迟。在这里执行相同的命令,对系统进行1000次压力测试,我的代码如下:

curl -s -v -i -I http://172.16.20.8:8000/files_to_curl/vid.mp4?[1-1000] | grep "Date:","%{http_code},%{time_namelookup},%{time_connect},%{time_appconnect},%{time_pretransfer},%{time_redirect},%{time_starttransfer},%{time_total},%{size_download},%{speed_download}\n" >> test_time.txt

我的问题是我一次只能保存一个信息,如果保存了日期,则无法进行延迟,反之亦然。我是Shell命令的新手,所以请告诉我我做错了什么地方。

curl
1个回答
1
投票

谢谢,马克西姆,我也想出了一种有用的方法。

从时间戳thists答案中,我尝试了此方法,并且效果很好:

curl -s -v -i -I http://xxx.xx.xx.x:8000/files_to_curl/vid.mp4?[1-1000] -o /dev/null -w ",%{http_code},%{time_namelookup},%{time_connect},%{time_appconnect},%{time_pretransfer},%{time_redirect},%{time_starttransfer},%{time_total},%{size_download},%{speed_download} \n" | ts '[%Y-%m-%d %H:%M:%S]' >> test_file.txt

© www.soinside.com 2019 - 2024. All rights reserved.