osnoz
osnoz

Reputation: 1197

/usr/bin/time file inputs / outputs

I'm struggling to find any detailed information about exactly what the various outputs of /usr/bin/time -v mean. Namely I'm confused about the meaning of file inputs / outputs.

If anyone has some experience with '/usr/bin/time' I'dd be grateful if you could straighten this out for me.

Upvotes: 2

Views: 786

Answers (1)

osgx
osgx

Reputation: 94345

What is your OS, is it linux of BSD?

There is some description of fields in man page of time utility (section 1), for example in Linux: http://man7.org/linux/man-pages/man1/time.1.html

But time itself uses some interface to kernel to get the information, probably wait3 / wait4 http://man7.org/linux/man-pages/man2/wait3.2.html Data printed in time -v is from struct rusage which is described in getrusage(2) man page: Linux http://man7.org/linux/man-pages/man2/getrusage.2.html

Linux have many fields in rusage, but not all fields are used:

   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 */
       };

The http://man7.org/linux/man-pages/man2/getrusage.2.html also give some description and mark unmaintained fields:

   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 have no exact list to implement, so it is implementation-specific http://pubs.opengroup.org/onlinepubs/009695399/functions/getrusage.html

The header shall define the rusage structure that includes at least the following members:

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

Upvotes: 1

Related Questions