欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

Linux中如何進(jìn)行命令運(yùn)行時(shí)間測(cè)試-創(chuàng)新互聯(lián)

這篇文章主要為大家展示了“Linux中如何進(jìn)行命令運(yùn)行時(shí)間測(cè)試”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“Linux中如何進(jìn)行命令運(yùn)行時(shí)間測(cè)試”這篇文章吧。

專注于為中小企業(yè)提供網(wǎng)站設(shè)計(jì)制作、做網(wǎng)站服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)安州免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了1000+企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

1. time 命令基本用法

time 命令最基本的用法,就是 time + 命令 ,比如:

$ time ping baidu.com 
PING baidu.com (123.125.114.144) 56(84) bytes of data. 
64 bytes from 123.125.114.144 (123.125.114.144): icmp_seq=1 ttl=56 time=2.83 ms 
64 bytes from 123.125.114.144 (123.125.114.144): icmp_seq=2 ttl=56 time=2.77 ms 
………… 
^C 
--- baidu.com ping statistics --- 
8 packets transmitted, 8 received, 0% packet loss, time 10818ms 
rtt min/avg/max/mdev = 2.765/2.808/2.862/0.039 ms 
 
real    0m11.173s 
user    0m0.004s 
sys     0m0.002s

在結(jié)果里,real 表示從我們執(zhí)行 ping 命令到最終按 ctrl+c 終止這段時(shí)間所耗費(fèi)的時(shí)間;user 及 sys 分別表示 ping 命令在用戶空間及內(nèi)核空間所運(yùn)行的時(shí)間。

2. 將時(shí)間信息寫入文件

如果我們想把時(shí)間信息直接寫入到文件,而不是顯示在屏幕上,那么我們可以使用 -o 選項(xiàng),并指定寫入的文件路徑。

$ /usr/bin/time -o /home/alvin/time-output.txt ping baidu.com

執(zhí)行這個(gè)命令后,ping 命令的輸出結(jié)果依然會(huì)在終端里,而 time 命令的結(jié)果就寫入到我們所指定的 time-output.txt 文件里。

-o 選項(xiàng)表示輸出文件不存在就創(chuàng)建,如果存在的話就直接覆蓋重寫。如果我們不想覆蓋重寫,而是想追加在文件后面,我們可以使用 -a 選項(xiàng)。

$ /usr/bin/time -a /home/smart/time-output.txt ping linoxide.com

3. 顯示更詳細(xì)的時(shí)間信息

time 命令不帶選項(xiàng)的話,顯示的信息量比較少,如果我們想獲得更詳細(xì)的信息,那么我們可以使用 -v 選項(xiàng)。

$ /usr/bin/time -v ping baidu.com 
PING baidu.com (123.125.114.144) 56(84) bytes of data. 
64 bytes from 123.125.114.144 (123.125.114.144): icmp_seq=1 ttl=56 time=2.75 ms 
64 bytes from 123.125.114.144 (123.125.114.144): icmp_seq=2 ttl=56 time=2.76 ms 
64 bytes from 123.125.114.144 (123.125.114.144): icmp_seq=3 ttl=56 time=2.85 ms 
64 bytes from 123.125.114.144 (123.125.114.144): icmp_seq=4 ttl=56 time=2.77 ms 
^C 
--- baidu.com ping statistics --- 
4 packets transmitted, 4 received, 0% packet loss, time 3300ms 
rtt min/avg/max/mdev = 2.751/2.785/2.851/0.075 ms 
        Command being timed: "ping baidu.com" 
        User time (seconds): 0.00 
        System time (seconds): 0.00 
        Percent of CPU this job got: 0% 
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:03.64 
        Average shared text size (kbytes): 0 
        Average unshared data size (kbytes): 0 
        Average stack size (kbytes): 0 
        Average total size (kbytes): 0 
        Maximum resident set size (kbytes): 2140 
        Average resident set size (kbytes): 0 
        Major (requiring I/O) page faults: 0 
        Minor (reclaiming a frame) page faults: 626 
        Voluntary context switches: 10 
        Involuntary context switches: 0 
        Swaps: 0 
        File system inputs: 0 
        File system outputs: 0 
        Socket messages sent: 0 
        Socket messages received: 0 
        Signals delivered: 0 
        Page size (bytes): 4096 
        Exit status: 0

這個(gè)結(jié)果信息就相當(dāng)詳細(xì)了,我們可以獲取到足夠多我們所需要的信息。

4. 自定義輸出格式

默認(rèn)情況下,time 命令只輸出 real,usr,sys 三個(gè)內(nèi)容,如果我們想要個(gè)性化一些,算定義它的輸出格式,time 命令也是支持的。time 命令支持的格式有很多,如下所示:

C - Name and command line arguments used 
D - Average size of the process's unshared data area in kilobytes 
E - Elapsed time in a clock format 
F - Number of page faults 
I - Number of file system inputs by the process 
K - Average total memory use of the process in kilobytes 
M - Maximum resident set the size of the process during the lifetime in Kilobytes 
O - Number of file system outputs by the process 
P - Percentage of CPU that the job received 
R - Number of minor or recoverable page faults 
S - Total number of CPU seconds used by the system in kernel mode 
U - Total number of CPU seconds used by user mode 
W - Number of times the process was swapped out of main memory 
X - Average amount of shared text in the process 
Z - System's page size in kilobytes 
c - Number of times the process was context-switched 
e - Elapsed real time used by the process in seconds 
k - Number of signals delivered to the process 
p - Average unshared stack size of the process in kilobytes 
r - Number of socket messages received by the process 
s - Number of socket messages sent by the process 
t - Average resident set size of the process in kilobytes 
w - Number of time the process was context-switched voluntarily 
x - Exit status of the command

如果我們想要輸出以下這樣的格式:

Elapsed Time = 0:01:00, Inputs 2, Outputs 1

我們可以這樣自定義:

$ /usr/bin/time -f "Elapsed Time = %E, Inputs %I, Outputs %O" ping baidu.com 
PING baidu.com (220.181.38.148) 56(84) bytes of data. 
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=1 ttl=54 time=1.82 ms 
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=2 ttl=54 time=1.86 ms 
^C 
--- baidu.com ping statistics --- 
4 packets transmitted, 4 received, 0% packet loss, time 3003ms 
rtt min/avg/max/mdev = 1.825/1.859/1.879/0.056 ms 
Elapsed Time = 0:03.92, Inputs 0, Outputs 0

如果你想讓輸出的結(jié)果有換行,可以在對(duì)應(yīng)的地方添加 \n ,比如:

$ /usr/bin/time -f "Elapsed Time = %E \n Inputs %I \n Outputs %O" ping baidu.com

這樣輸出的結(jié)果就類似于這樣:

Elapsed Time = 0:03.92 
Inputs 0 
Outputs 0

以上是“Linux中如何進(jìn)行命令運(yùn)行時(shí)間測(cè)試”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道!

網(wǎng)站欄目:Linux中如何進(jìn)行命令運(yùn)行時(shí)間測(cè)試-創(chuàng)新互聯(lián)
標(biāo)題路徑:http://aaarwkj.com/article12/dipcgc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供虛擬主機(jī)、移動(dòng)網(wǎng)站建設(shè)、動(dòng)態(tài)網(wǎng)站、搜索引擎優(yōu)化、網(wǎng)站設(shè)計(jì)、網(wǎng)站設(shè)計(jì)公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)頁設(shè)計(jì)公司
av中文字幕国产精品| 91中文字幕精品一区二区| 欧美成人精品视频在线不卡| 青青草视频免费观看高清在线观看新 | 成年人免费在线观看毛片| 中文字幕国产精品资源| 青草成人在线视频观看| 97碰碰视频在线观看| 日韩欧美中文字幕区| 亚洲精品欧美日韩久久| 精品国产一区二区日韩91| 青青草免费在线视频蜜臀| 欧美日韩国产精品乱人伦| 国产精品情侣av自拍| 国产一区二区黄色录像| 91黑丝国产在线播放| 日日躁夜夜躁狠狠躁黑人| 99国产精品热久久婷婷| 亚洲午夜精品日韩乱码| 91久久亚洲综合精品成人| 美女后入式在线观看| 国产精品美女丝袜久久久| 国产传媒免费在线播放| 美国一级二级三级黄片| 中文字幕亚洲入口久久| 色婷婷av一二三区竹菊| 日本中文字幕一区在线观看| 国内熟妇人妻色在线三级| 日本免费精品人成视频| 91人妻一区二区三区久久| 国产精品v一区二区三区| 国产高清av免费在线观看| 人妻系列少妇人妻偷人| 黄色亚洲一区二区三区四区| sedoge在线播放免费有码| 国产精品熟女一区二区三区| 亚洲一区欧美日韩91| 哪里可以看日韩免费毛片| 亚洲天堂av成人在线观看| 日韩在线视频免费不卡一区| 亚洲美女高潮久久久久久久久|