20220517_统计脚本运行过程中使用的时间和运行内存
必须使用/usr/bin/time调用time命令,不能直接使用time命令
代码语言:javascript复制(base) root@dell-server:/home/newdisk_dell_5/wilson/chlo_hmmsearch/test# /usr/bin/time -v python chlo_hmmsearch-3.py
# CPU time: 2.13u 0.02s 00:00:02.15 Elapsed: 00:00:02.15
Command being timed: "python chlo_hmmsearch-3.py"
User time (seconds): 166.29
System time (seconds): 77.66
Percent of CPU this job got: 801%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:30.45
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): 546040
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 18963522
Voluntary context switches: 1917780
Involuntary context switches: 138031
Swaps: 0
File system inputs: 56
File system outputs: 901984
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
(一)时间相关
(二)内存相关
(三)IO 相关
(四)统计信息输出到文件
如果你希望将 time 统计的信息输出到文件,可以使用 -o 选项
代码语言:javascript复制root@chopin:~$ /usr/bin/time -v -o a.txt sleep 2
统计信息直接保存到了 a.txt,如果你希望统计信息能够追加到文件,可以额外加 -a 选项