Time 如何编写基准统计数据。如何将“时间”的输出放入文件中

Time 如何编写基准统计数据。如何将“时间”的输出放入文件中,time,command-line,Time,Command Line,我无法将“时间”输出放入文件。 当我在linux控制台上使用time program>file时,我没有从程序时间获得任何输出信息 我需要3位时间输出,看起来像控制台上的时间-o outputfile.txt命令提供完整输出: %用户%s系统%e失效%PCPU%Xtext+%Ddata%Mmaxk %Iinputs+%ooput%Fmajor+%Rminorpagefaults%Wswaps 如果添加-p,则会得到三行输出,如交互式控制台中的输出: 与: 资料来源:人工时间:有趣。时间ls>ou

我无法将“时间”输出放入文件。 当我在linux控制台上使用time program>file时,我没有从程序时间获得任何输出信息


我需要3位时间输出,看起来像控制台上的时间-o outputfile.txt命令提供完整输出:

%用户%s系统%e失效%PCPU%Xtext+%Ddata%Mmaxk %Iinputs+%ooput%Fmajor+%Rminorpagefaults%Wswaps

如果添加-p,则会得到三行输出,如交互式控制台中的输出:

与:


资料来源:人工时间:

有趣。时间ls>output.txt不工作&2和1等,但只有2位精度。如果你在正常模式下运行,你会得到3。这不是答案你可以在这里找到答案,然后:
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.