将'time'输出放到文件中时遇到问题。 当我在linux控制台上使用时间程序>文件我没有从程序时间输出信息。
我需要3位时间输出,看起来像在控制台上
答案 0 :(得分:0)
" time -o outputfile.txt命令"给你一个完整的输出:
%Uuser%Ssystem%Eelapsed%PCPU(%Xtext +%Ddata%Mmax)k
%Iinputs +%Ooutputs(%Fmajor +%Rminor)pagefaults%Wswaps
如果你添加" -p"你可以在交互式控制台中获得三行输出:
real %e user %U sys %S
使用:
Time %E Elapsed real time (in [hours:]minutes:seconds). %e (Not in tcsh.) Elapsed real time (in seconds). %S Total number of CPU-seconds that the process spent in kernel mode. %U Total number of CPU-seconds that the process spent in user mode. %P Percentage of the CPU that this job got, computed as (%U + %S) / %E. Memory %M Maximum resident set size of the process during its lifetime, in Kbytes. %t (Not in tcsh.) Average resident set size of the process, in Kbytes. %K Average total (data+stack+text) memory use of the process, in Kbytes. %D Average size of the process's unshared data area, in Kbytes. %p (Not in tcsh.) Average size of the process's unshared stack space, in Kbytes. %X Average size of the process's shared text space, in Kbytes. %Z (Not in tcsh.) System's page size, in bytes. This is a per-sys- tem constant, but varies between systems. %F Number of major page faults that occurred while the process was running. These are faults where the page has to be read in from disk. %R Number of minor, or recoverable, page faults. These are faults for pages that are not valid but which have not yet been claimed by other virtual pages. Thus the data in the page is still valid but the system tables must be updated. %W Number of times the process was swapped out of main memory. %c Number of times the process was context-switched involuntarily (because the time slice expired). %w Number of waits: times that the program was context-switched voluntarily, for instance while waiting for an I/O operation to complete. I/O %I Number of file system inputs by the process. %O Number of file system outputs by the process. %r Number of socket messages received by the process. %s Number of socket messages sent by the process. %k Number of signals delivered to the process. %C (Not in tcsh.) Name and command line arguments of the command being timed. %x (Not in tcsh.) Exit status of the command.
来源:男人时间:)