/ usr / bin /时间文件输入/输出

时间:2016-10-13 18:48:11

标签: unix time command-line profiling getrusage

我正在努力寻找有关n各种输出的确切含义的详细信息。也就是说,我对文件输入/输出的含义感到困惑。

如果有人对' / usr / bin / time'如果你能帮我解决这个问题,我将不胜感激。

1 个答案:

答案 0 :(得分:0)

你的操作系统是什么,是BSD的linux吗?

time实用程序(第1部分)的手册页中有一些字段描述,例如在Linux中:http://man7.org/linux/man-pages/man1/time.1.html

但是时间本身使用一些内核接口来获取信息,可能是wait3 / wait4 http://man7.org/linux/man-pages/man2/wait3.2.html time -v中打印的数据来自struct rusagegetrusage(2)手册页中描述了这一点:Linux http://man7.org/linux/man-pages/man2/getrusage.2.html

Linux在rusage中有许多字段,但并非所有字段都使用:

   The resource usages are returned in the structure pointed to by
   usage, which has the following form:

       struct rusage {
           struct timeval ru_utime; /* user CPU time used */
           struct timeval ru_stime; /* system CPU time used */
           long   ru_maxrss;        /* maximum resident set size */
           long   ru_ixrss;         /* integral shared memory size */
           long   ru_idrss;         /* integral unshared data size */
           long   ru_isrss;         /* integral unshared stack size */
           long   ru_minflt;        /* page reclaims (soft page faults) */
           long   ru_majflt;        /* page faults (hard page faults) */
           long   ru_nswap;         /* swaps */
           long   ru_inblock;       /* block input operations */
           long   ru_oublock;       /* block output operations */
           long   ru_msgsnd;        /* IPC messages sent */
           long   ru_msgrcv;        /* IPC messages received */
           long   ru_nsignals;      /* signals received */
           long   ru_nvcsw;         /* voluntary context switches */
           long   ru_nivcsw;        /* involuntary context switches */
       };

http://man7.org/linux/man-pages/man2/getrusage.2.html也会给出一些说明并标记未维护的字段:

   ru_utime
   ru_stime
   ru_maxrss (since Linux 2.6.32)
   ru_ixrss (unmaintained)
   ru_idrss (unmaintained)
   ru_isrss (unmaintained)
   ru_minflt
   ru_majflt
   ru_nswap (unmaintained)
   ru_inblock (since Linux 2.6.22)
          The number of times the filesystem had to perform input.
   ru_oublock (since Linux 2.6.22)
          The number of times the filesystem had to perform output.
   ru_msgsnd (unmaintained)
   ru_msgrcv (unmaintained)
   ru_nsignals (unmaintained)
   ru_nvcsw (since Linux 2.6)
   ru_nivcsw (since Linux 2.6)

POSIX 2004没有要实现的确切列表,因此它是特定于实现的http://pubs.opengroup.org/onlinepubs/009695399/functions/getrusage.html

  

标题应定义包含至少以下成员的rusage结构:

struct timeval ru_utime  User time used. 
struct timeval ru_stime  System time used.