欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

linux之time命令

程序员文章站 2024-01-22 19:57:22
...

NAME
time - time a simple command or give resource usage

SYNOPSIS
time [options] command [arguments…]

OPTIONS
-p When in the POSIX locale, use the precise traditional for‐
mat

              "real %f\nuser %f\nsys %f\n"

          (with numbers in seconds) where the number of  decimals  in
          the  output  for  %f  is  unspecified  but is sufficient to
          express the clock tick accuracy, and at least one.

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 ker‐
          nel 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  life‐
          time, 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-system 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 involun‐
tarily (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  com‐
          mand being timed.

   %x     (Not in tcsh.) Exit status of the command.

GNU options
-f FORMAT, --format=FORMAT
Specify output format, possibly overriding the format spec‐
ified in the environment variable TIME.

   -p, --portability
          Use the portable output format.

   -o FILE, --output=FILE
          Do not send the results to stderr, but overwrite the speci‐
          fied file.

   -a, --append
          (Used together with -o.) Do not overwrite but append.

   -v, --verbose
          Give very verbose output about all the program knows about.

GNU standard options
–help Print a usage message on standard output and exit success‐
fully.

   -V, --version
          Print version information on  standard  output,  then  exit
          successfully.

   --     Terminate option list.

name

时间-时间一个简单的命令或给资源的使用

语法

时间[选项]命令[参数…]

option

-p 当在POSIX现场时,使用精确的传统for‐垫"real %f\nuser %f\nsys %f\n"(以秒为单位的数字),小数的个数为
%f 输出未指定,但已足够表示时钟滴答精度,且至少一个。

time

实际运行时间(以[小时:]分:秒为单位)。
%e(不是在tcsh中)经过实际时间(以秒为单位)。
%S进程在ker‐中花费的cpu秒总数nel模式。进程在用户中花费的cpu秒数模式。此作业获得的CPU的百分比,计算为(%U +)% S) / % E。

memory

进程在其生命周期内的最大驻留集大小
%M时间 kb。
%t(不在tcsh中)进程的平均常驻集大小,kb。
%K平均总(数据+堆栈+文本)内存使用进程,kb。进程的非共享数据区域的平均大小,单位kb。
%p(不在tcsh中)进程非共享堆栈的平均大小空间,单位kb。
%X进程共享文本空间的平均大小,单位为Kbytes。
%Z(不在tcsh中)系统的页大小,以字节为单位。这是一个每个系统都是常数,但是在不同的系统之间是不同的。
%F进程中发生的主要页面错误数是运行。这些是页面必须存在的错误从磁盘读入。次要的或可恢复的页错误的数目。这些都是无效但尚未有效的页面的错误被其他虚拟页面声明。中的数据页面仍然有效,但是必须更新系统表。从主存中交换进程的次数。
%c进程被上下文切换所涉及的次数自愿(因为时间片过期了)。
%w等待数:程序为上下文-的时间自动切换,例如在等待I/O时操作完成。

I / O

由进程输入的文件系统数目。进程输出的文件系统数量。进程接收的套接字消息的数目。进程发送的套接字消息的数目。
%k发送给进程的信号数。
%C(不在tcsh中)com‐的名称和命令行参数
需求的时间。
%x(不在tcsh中)命令的退出状态。

GNU选项

  • f格式,格式格式
    指定输出格式,可能覆盖格式说明
    在环境变量时间中ified。
  • p,可移植性
    使用可移植的输出格式。
  • o文件,输出=文件
    不要将结果发送到stderr,而是覆盖参数
    同一标准的文件。
    ————附加
    (与-o连用)不要覆盖,但要追加。
  • v,详细
    给出非常详细的关于程序所知道的所有内容的输出。

GNU标准选择
—帮助在标准输出上打印使用信息并退出成功完全。

  • v,版本
    在标准输出上打印版本信息,然后退出成功。
    ——终止选项列表。
相关标签: linux