Accepting request 198137 from home:sbrabec:branches:Base:System

- Sync patches with Debian and Fedora:
  * Add man page (time.1).
  * Less nonverbose output (time-fedora-verbose.patch).
  * Fix maximal RSS report
    (time-fedora-ru_maxrss-is-in-kilobytes-on-Linux.patch,
    bnc#836049, Redhat#702826).
  * Switch to microsecond accuracy if miliseconds arithmetic rounds
    to zero
    (time-fedora-Recompute-CPU-usage-at-microsecond-level.patch,
    Redhat#527276).
  * When time exits in a non-normal way, return 128 plus the number
    of the signal which caused time to stop or abort
    (time-debian-non-normal-exit.patch).
  * struct rusage and sys/resource.h portability fix
    (time-debian-rusage-portability.patch, Debian#144819).
  * Add -q,--quiet functionality
    (time-debian-quiet.patch, Debian#56853).
  * Update bug reporting address
    (time-debian-bug-address.patch, Debian#542469).
  * Modernize the configure.in file to current autoconf style
    (time-debian-configure.patch).
  * Add a directory entry to the info page
    (time-debian-info-direntry.patch).
- Fix FSF address (time-fsf-address.patch).
- Update Summary.
- Rename time-1.7.diff to time-alpha.patch.

... And cherry pick changelog entries relevant to time.

OBS-URL: https://build.opensuse.org/request/show/198137
OBS-URL: https://build.opensuse.org/package/show/Base:System/time?expand=0&rev=3
This commit is contained in:
Dr. Werner Fink 2013-09-12 17:31:14 +00:00 committed by Git OBS Bridge
parent 2185629ae3
commit bce8f29a0e
15 changed files with 930 additions and 12 deletions

26
time-alpha.patch Normal file
View File

@ -0,0 +1,26 @@
---
resuse.h | 4 ++++
1 file changed, 4 insertions(+)
Index: time-1.7/resuse.h
===================================================================
--- time-1.7.orig/resuse.h
+++ time-1.7/resuse.h
@@ -39,6 +39,9 @@ struct timeval
# if HAVE_WAIT3
# include <sys/resource.h>
# else
+# if defined(__linux__) && defined(__alpha__)
+# include <sys/resource.h>
+# else
/* Process resource usage structure. */
struct rusage
{
@@ -49,6 +52,7 @@ struct rusage
ru_oublock, ru_msgsnd, ru_msgrcv, ru_nsignals,
ru_nvcsw, ru_nivcsw;
};
+# endif
# endif
#endif

View File

@ -0,0 +1,26 @@
Description: Update bug reporting address.
* Reported by Faheem Mitha.
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=542469
Author: Bob Proulx
--- time-1.7.orig/README
+++ time-1.7/README
@@ -8,6 +8,6 @@
See the file INSTALL for compilation and installation instructions.
Mail suggestions and bug reports for GNU time to
-bug-gnu-utils@prep.ai.mit.edu. Please include the version of
+bug-gnu-utils@gnu.org. Please include the version of
`time', which you can get by running `time --version', and the
operating system and C compiler you used.
--- time-1.7.orig/time.texi
+++ time-1.7/time.texi
@@ -137,7 +143,7 @@
@end example
Mail suggestions and bug reports for GNU @code{time} to
-@code{bug-gnu-utils@@prep.ai.mit.edu}. Please include the version of
+@code{bug-gnu-utils@@gnu.org}. Please include the version of
@code{time}, which you can get by running @samp{time --version}, and the
operating system and C compiler you used.

View File

@ -0,0 +1,28 @@
Description: Update configure.in file to current format for autoconf version 2.x.
* Modernize the configure.in file to current autoconf style.
* No need to rename to configure.ac since configure.in still works fine.
Author: Bob Proulx
--- time-1.7.orig/configure.in
+++ time-1.7/configure.in
@@ -1,11 +1,7 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(time.c)
-VERSION=1.7
-AC_SUBST(VERSION)
-PACKAGE=time
-AC_SUBST(PACKAGE)
-AC_ARG_PROGRAM
+AC_INIT([time],[1.7])
+AM_INIT_AUTOMAKE([-Wall])
dnl Checks for programs.
AC_PROG_CC
@@ -39,4 +35,5 @@
AC_MSG_RESULT($have_gp)
test $have_gp = yes && AC_DEFINE(HAVE_GETPAGESIZE)
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT

View File

@ -0,0 +1,20 @@
Description: Add a directory entry to the info page.
This patch seems to have always been part of the package but its
origin is undocumented.
Author: Debian
--- time-1.7.orig/time.texi
+++ time-1.7/time.texi
@@ -11,6 +11,12 @@
@finalout
@end iftex
+@dircategory Individual utilities
+@direntry
+* time: (time). Run programs and summarize
+ system resource usage.
+@end direntry
+
@ifinfo
This file documents the the GNU @code{time} command for running programs
and summarizing the system resources they use.

119
time-debian-info-nav.patch Normal file
View File

@ -0,0 +1,119 @@
Description: Fix info navigation structure
In the original when using the standalone 'info' program pressing
spacebar does not navigate through the pages. This patch
restructures the node navigation somewhat to enable this to happen.
Reported by Russ Allbery.
Author: Bob Proulx
--- a/time.texi
+++ b/time.texi
@@ -70,7 +70,10 @@
by the Foundation.
@end titlepage
-@node Top, , (dir), (dir)
+@contents
+
+@node Top
+@top The GNU @code{time} Command
@ifinfo
This file documents the the GNU @code{time} command for running programs
@@ -80,30 +83,12 @@
@menu
* Resource Measurement:: Measuring program resource use.
-
- --- The Detailed Node Listing ---
-
-Measuring Program Resource Use
-
-* Setting Format:: Selecting the information reported by @code{time}.
-* Format String:: The information @code{time} can report.
-* Redirecting:: Writing the information to a file.
-* Examples:: Examples of using @code{time}.
-* Accuracy:: Limitations on the accuracy of @code{time} output.
-* Invoking time:: Summary of the options to the @code{time} command.
-
-The Format String
-
-* Time Resources::
-* Memory Resources::
-* I/O Resources::
-* Command Info::
+* Concept index:: Index of concepts.
@end menu
-@node Resource Measurement, , , Top
+@node Resource Measurement
@chapter Measuring Program Resource Use
-@findex time
-@kindex time
+@cindex time invocation
@pindex time
@pindex measurement
@@ -125,7 +110,7 @@
time @r{[}option@dots{}@r{]} @var{command} @r{[}@var{arg}@dots{}@r{]}
@end example
-@kindex resources
+@cindex resource specifiers
@code{time} runs the program @var{command}, with any given arguments
@var{arg}@dots{}. When @var{command} finishes, @code{time} displays
information about resources used by @var{command}.
@@ -197,7 +182,7 @@
@item -v
@itemx --verbose
-@cindex format
+@cindex verbose format
Use the built-in verbose format, which displays each available piece of
information on the program's resource use on its own line, with an
English description of its meaning.
@@ -207,7 +192,6 @@
@section The Format String
@cindex format
-@kindex resource
The @dfn{format string} controls the contents of the @code{time} output.
It consists of @dfn{resource specifiers} and @dfn{escapes}, interspersed
with plain text.
@@ -450,7 +434,7 @@
@node Accuracy
@section Accuracy
-@kindex error (in measurement)
+@cindex error (in measurement)
The elapsed time is not collected atomically with the execution of the
program; as a result, in bizarre circumstances (if the @code{time}
@@ -489,7 +473,7 @@
time @r{[}option@dots{}@r{]} @var{command} @r{[}@var{arg}@dots{}@r{]}
@end example
-@kindex resources
+@cindex resources
@code{time} runs the program @var{command}, with any given arguments
@var{arg}@dots{}. When @var{command} finishes, @code{time} displays
information about resources used by @var{command} (on the standard error
@@ -524,7 +508,7 @@
@item -v
@itemx --verbose
-@cindex format
+@cindex verbose option
Use the built-in verbose format.
@item -V
@@ -533,5 +517,9 @@
Print the version number of @code{time} and exit.
@end table
-@contents
+@node Concept index
+@unnumbered Concept index
+
+@printindex cp
+
@bye

View File

@ -0,0 +1,23 @@
Subject: Adjust non-normal exit code
* Introduced in Debian time version 1.7-16
* time.c: When time exits in a non-normal way, return 128 plus the
number of the signal which caused time to stop or abort. Thanks to
Steve Greenland and Herbert Xu for some clarification in this matter.
Author: Dirk Eddelbuettel
--- time-1.7.orig/time.c
+++ time-1.7/time.c
@@ -664,9 +664,9 @@
fflush (outfp);
if (WIFSTOPPED (res.waitstatus))
- exit (WSTOPSIG (res.waitstatus));
+ exit (WSTOPSIG (res.waitstatus) + 128);
else if (WIFSIGNALED (res.waitstatus))
- exit (WTERMSIG (res.waitstatus));
+ exit (WTERMSIG (res.waitstatus) + 128);
else if (WIFEXITED (res.waitstatus))
exit (WEXITSTATUS (res.waitstatus));
}

85
time-debian-quiet.patch Normal file
View File

@ -0,0 +1,85 @@
Description: Adds -q,--quiet functionality.
Requested by Adam Heath.
Author: Dirk Eddelbuettel
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=56853
--- time-1.7.orig/time.texi
+++ time-1.7/time.texi
@@ -185,6 +185,10 @@
sys %S
@end example
+@item -q
+@itemx --quiet
+Suppress non-zero error code from the executed program.
+
@item -v
@itemx --verbose
@cindex format
--- time-1.7.orig/time.c
+++ time-1.7/time.c
@@ -147,6 +147,10 @@
NULL
};
+
+/* If true, do not show the exit message */
+static boolean quiet;
+
/* If true, show an English description next to each statistic. */
static boolean verbose;
@@ -172,6 +176,7 @@
{"help", no_argument, NULL, 'h'},
{"output-file", required_argument, NULL, 'o'},
{"portability", no_argument, NULL, 'p'},
+ {"quiet", no_argument,NULL, 'q'},
{"verbose", no_argument, NULL, 'v'},
{"version", no_argument, NULL, 'V'},
{NULL, no_argument, NULL, 0}
@@ -337,7 +342,8 @@
else if (WIFSIGNALED (resp->waitstatus))
fprintf (fp, "Command terminated by signal %d\n",
WTERMSIG (resp->waitstatus));
- else if (WIFEXITED (resp->waitstatus) && WEXITSTATUS (resp->waitstatus))
+ else if (WIFEXITED (resp->waitstatus) && WEXITSTATUS (resp->waitstatus)
+ && !quiet)
fprintf (fp, "Command exited with non-zero status %d\n",
WEXITSTATUS (resp->waitstatus));
}
@@ -545,6 +551,7 @@
char *format; /* Format found in environment. */
/* Initialize the option flags. */
+ quiet = false;
verbose = false;
outfile = NULL;
outfp = stderr;
@@ -558,7 +565,7 @@
if (format)
output_format = format;
- while ((optc = getopt_long (argc, argv, "+af:o:pvV", longopts, (int *) 0))
+ while ((optc = getopt_long (argc, argv, "+af:o:pqvV", longopts, (int *) 0))
!= EOF)
{
switch (optc)
@@ -577,6 +584,9 @@
case 'p':
output_format = posix_format;
break;
+ case 'q':
+ quiet = true;
+ break;
case 'v':
verbose = true;
break;
@@ -679,7 +689,7 @@
fprintf (stream, "\
Usage: %s [-apvV] [-f format] [-o file] [--append] [--verbose]\n\
[--portability] [--format=format] [--output=file] [--version]\n\
- [--help] command [arg...]\n",
+ [--quiet] [--help] command [arg...]\n",
program_name);
exit (status);
}

View File

@ -0,0 +1,41 @@
Subject: struct rusage and sys/resource.h portability fix
Author: Dirk Eddelbuettel
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=144819
--- time-1.7.orig/resuse.h
+++ time-1.7/resuse.h
@@ -38,22 +38,11 @@
#else
# define TV_MSEC tv_usec / 1000
# define TV_USEC tv_usec
-# if HAVE_WAIT3
+# if HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
# else
# if defined(__linux__) && defined(__alpha__)
# include <sys/resource.h>
-# else
-/* Process resource usage structure. */
-struct rusage
-{
- struct timeval ru_utime; /* User time used. */
- struct timeval ru_stime; /* System time used. */
- int ru_maxrss, ru_ixrss, ru_idrss, ru_isrss,
- ru_minflt, ru_majflt, ru_nswap, ru_inblock,
- ru_oublock, ru_msgsnd, ru_msgrcv, ru_nsignals,
- ru_nvcsw, ru_nivcsw;
-};
# endif
# endif
#endif
--- time-1.7.orig/configure.in
+++ time-1.7/configure.in
@@ -15,7 +15,7 @@
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(unistd.h string.h sys/rusage.h)
+AC_CHECK_HEADERS(unistd.h string.h sys/rusage.h sys/resource.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

View File

@ -0,0 +1,72 @@
From 0d743a7d946fe176a07baf2586a6af0e867fd89c Mon Sep 17 00:00:00 2001
From: H.J. Lu <hongjiu.lu@intel.com>
Date: Wed, 11 May 2011 16:19:55 +0200
Subject: [PATCH] Recompute CPU usage at microsecond level
If job finishes quickly, miliseconds arithmetic rounds to zero. If
that happens, recalculate CPU usage ratio with microsecond accuracy
to raise chance to get non-zero values.
---
resuse.h | 2 ++
time.c | 15 +++++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/resuse.h b/resuse.h
index 992143f..7a3ee66 100644
--- a/resuse.h
+++ b/resuse.h
@@ -33,9 +33,11 @@ struct timeval
#if HAVE_SYS_RUSAGE_H
/* This rusage structure measures nanoseconds instead of microseconds. */
# define TV_MSEC tv_nsec / 1000000
+# define TV_USEC tv_nsec / 1000
# include <sys/rusage.h>
#else
# define TV_MSEC tv_usec / 1000
+# define TV_USEC tv_usec
# if HAVE_WAIT3
# include <sys/resource.h>
# else
diff --git a/time.c b/time.c
index 43aec0b..96cfdde 100644
--- a/time.c
+++ b/time.c
@@ -326,6 +326,8 @@ summarize (fp, fmt, command, resp)
{
unsigned long r; /* Elapsed real milliseconds. */
unsigned long v; /* Elapsed virtual (CPU) milliseconds. */
+ unsigned long ru; /* Elapsed real microseconds. */
+ unsigned long vu; /* Elapsed virtual (CPU) microseconds. */
if (verbose)
{
@@ -350,6 +352,17 @@ summarize (fp, fmt, command, resp)
v = resp->ru.ru_utime.tv_sec * 1000 + resp->ru.ru_utime.TV_MSEC +
resp->ru.ru_stime.tv_sec * 1000 + resp->ru.ru_stime.TV_MSEC;
+ if (r == 0 && v == 0)
+ {
+ ru = resp->elapsed.tv_usec;
+ vu = resp->ru.ru_utime.TV_USEC + resp->ru.ru_stime.TV_USEC;
+ }
+ else
+ {
+ ru = 0;
+ vu = 0;
+ }
+
while (*fmt)
{
switch (*fmt)
@@ -408,6 +421,8 @@ summarize (fp, fmt, command, resp)
/* % cpu is (total cpu time)/(elapsed time). */
if (r > 0)
fprintf (fp, "%lu%%", (v * 100 / r));
+ else if (ru > 0)
+ fprintf (fp, "%lu%%", (vu * 100 / ru));
else
fprintf (fp, "?%%");
break;
--
1.7.4.4

View File

@ -0,0 +1,32 @@
From ad24a929bdcc15abae14a64ea21b821bcd8cb030 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 11 May 2011 15:19:11 +0200
Subject: [PATCH] ru_maxrss is in kilobytes on Linux
Since 2.6.32 Linux returns ru_maxrss in kilobytes. Not in pages.
See http://lists.gnu.org/archive/html/bug-gnu-utils/2008-12/msg00047.html
for discussion.
---
time.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/time.c b/time.c
index d15fee4..43aec0b 100644
--- a/time.c
+++ b/time.c
@@ -395,7 +395,11 @@ summarize (fp, fmt, command, resp)
ptok ((UL) resp->ru.ru_ixrss) / MSEC_TO_TICKS (v));
break;
case 'M': /* Maximum resident set size. */
+#ifdef __linux__
+ fprintf (fp, "%ld", resp->ru.ru_maxrss);
+#else
fprintf (fp, "%lu", ptok ((UL) resp->ru.ru_maxrss));
+#endif
break;
case 'O': /* Outputs. */
fprintf (fp, "%ld", resp->ru.ru_oublock);
--
1.7.4.4

19
time-fedora-verbose.patch Normal file
View File

@ -0,0 +1,19 @@
--- time-1.7/time.c.verbose Fri Jun 14 05:38:21 1996
+++ time-1.7/time.c Sun Nov 4 16:21:09 2001
@@ -327,6 +327,8 @@
unsigned long r; /* Elapsed real milliseconds. */
unsigned long v; /* Elapsed virtual (CPU) milliseconds. */
+ if (verbose)
+ {
if (WIFSTOPPED (resp->waitstatus))
fprintf (fp, "Command stopped by signal %d\n",
WSTOPSIG (resp->waitstatus));
@@ -336,6 +338,7 @@
else if (WIFEXITED (resp->waitstatus) && WEXITSTATUS (resp->waitstatus))
fprintf (fp, "Command exited with non-zero status %d\n",
WEXITSTATUS (resp->waitstatus));
+ }
/* Convert all times to milliseconds. Occasionally, one of these values
comes out as zero. Dividing by zero causes problems, so we first

15
time-fsf-address.patch Normal file
View File

@ -0,0 +1,15 @@
Index: time-1.7/COPYING
===================================================================
--- time-1.7.orig/COPYING
+++ time-1.7/COPYING
@@ -1,8 +1,8 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, USA
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

325
time.1 Normal file
View File

@ -0,0 +1,325 @@
.\" Man page added by Dirk Eddelbuettel <edd@debian.org> on 15 Apr 1996
.\" Thanks to Herbert Thielen for a patch
.\" Copyright (C) Dirk Eddelbuettel but freely redistributable
.TH TIME 1 "Debian GNU/Linux"
.\" Always turn off hyphenation; it makes way too many mistakes in
.\" technical documents.
.nh
.SH NAME
time \- run programs and summarize system resource usage
.SH SYNOPSIS
.na
.TP
.B time
[
.B \-apqvV
] [
.BI \-f " FORMAT"
] [
.BI \-o " FILE"
]
.br
[
.B \-\-append
] [
.B \-\-verbose
] [
.B \-\-quiet
] [
.B \-\-portability
]
.br
[
.BI \-\-format= "FORMAT"
] [
.BI \-\-output= "FILE"
] [
.B \-\-version
]
.br
[
.B \-\-help
]
.I COMMAND
[
.I ARGS
]
.ad b
.\" For nroff, turn off justification.
.if n .ad l
.SH DESCRIPTION
.B time
run the program
.I COMMAND
with any given arguments
.IR "ARG..." .
When
.I COMMAND
finishes,
.B time
displays information about resources used by
.I COMMAND
(on the standard error output, by default). If
.I COMMAND
exits with non\-zero status,
.B time
displays a warning message and the exit status.
.B time
determines which information to display about the resources used by the
.I COMMAND
from the string
.IR FORMAT .
If no format is specified on the command line, but the
.B TIME
environment variable is set, its value is used as the format.
Otherwise, a default format built into
.B time
is used.
Options to
.B time
must appear on the command line before
.IR COMMAND .
Anything on the command line after
.I COMMAND
is passed as arguments to
.IR COMMAND .
.SH OPTIONS
.TP
.BI \-o " FILE, " \-\-output= "FILE "
Write the resource use statistics to
.I FILE
instead of to the standard error stream. By default, this overwrites the
file, destroying the file's previous contents. This option is useful for
collecting information on interactive programs and programs that produce
output on the standard error stream.
.TP
.BR \-a ", " \-\-append ""
Append the resource use information to the output file instead of overwriting
it. This option is only useful with the `\-o' or `\-\-output' option.
.TP
.BI \-f " FORMAT, " \-\-format " FORMAT "
Use
.I FORMAT
as the format string that controls the output of
.BR time .
See the below more information.
.TP
.B \-\-help
Print a summary of the command line options and exit.
.TP
.BR \-p ", " \-\-portability ""
Use the following format string, for conformance with POSIX standard 1003.2:
real %e
user %U
sys %S
.TP
.BR \-v ", " \-\-verbose ""
Use the built\-in verbose format, which displays each available piece of
information on the program's resource use on its own line, with an English
description of its meaning.
.TP
.B \-\-quiet
Do not report the status of the program even if it is different from zero.
.TP
.BR \-V ", " \-\-version ""
Print the version number of
.B time
and exit.
.SH "FORMATTING THE OUTPUT"
The format string
.I FORMAT
controls the contents of the
.B time
output. The format string can be set using the `\-f' or `\-\-format', `\-v' or
`\-\-verbose', or `\-p' or `\-\-portability' options. If they are not
given, but the
.I TIME
environment variable is set, its value is used as the format string.
Otherwise, a built\-in default format is used. The default format is:
%Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k
%Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps
The format string usually consists of `resource specifiers'
interspersed with plain text. A percent sign (`%') in the format
string causes the following character to be interpreted as a resource
specifier, which is similar to the formatting characters in the
.BR printf (3)
function.
A backslash (`\\') introduces a `backslash escape', which is
translated into a single printing character upon output. `\\t' outputs
a tab character, `\\n' outputs a newline, and `\\\\' outputs a backslash.
A backslash followed by any other character outputs a question mark
(`?') followed by a backslash, to indicate that an invalid backslash
escape was given.
Other text in the format string is copied verbatim to the output.
.B time
always prints a newline after printing the resource use
information, so normally format strings do not end with a newline
character (or `\en').
There are many resource specifications. Not all resources are
measured by all versions of Unix, so some of the values might be
reported as zero. Any character following a percent sign that is not
listed in the table below causes a question mark (`?') to be output,
followed by that character, to indicate that an invalid resource
specifier was given.
.\" No blank line between the resource specifiers below so that they
.\" are more compactly listed.
.PD 0
The resource specifiers, which are a superset of those recognized by the
.BR tcsh (1)
builtin `time' command, are:
.RS
.IP %
A literal `%'.
.IP C
Name and command line arguments of the command being timed.
.IP D
Average size of the process's unshared data area, in Kilobytes.
.IP E
Elapsed real (wall clock) time used by the process, in [hours:]minutes:seconds.
.IP F
Number of major, or I/O\-requiring, page faults that occurred while
the process was running. These are faults where the page has
actually migrated out of primary memory.
.IP I
Number of file system inputs by the process.
.IP K
Average total (data+stack+text) memory use of the process, in
Kilobytes.
.IP M
Maximum resident set size of the process during its lifetime, in
Kilobytes.
.IP O
Number of file system outputs by the process.
.IP P
Percentage of the CPU that this job got. This is just user +
system times divided by the total running time. It also prints
a percentage sign.
.IP R
Number of minor, or recoverable, page faults. These are pages
that are not valid (so they fault) 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.
.IP S
Total number of CPU\-seconds used by the system on behalf of the
process (in kernel mode), in seconds.
.IP U
Total number of CPU\-seconds that the process used directly (in user
mode), in seconds.
.IP W
Number of times the process was swapped out of main memory.
.IP X
Average amount of shared text in the process, in Kilobytes.
.IP Z
System's page size, in bytes. This is a per\-system constant, but
varies between systems.
.IP c
Number of times the process was context\-switched involuntarily
(because the time slice expired).
.IP e
Elapsed real (wall clock) time used by the process, in seconds.
.IP k
Number of signals delivered to the process.
.IP p
Average unshared stack size of the process, in Kilobytes.
.IP r
Number of socket messages received by the process.
.IP s
Number of socket messages sent by the process.
.IP t
Average resident set size of the process, in Kilobytes.
.IP w
Number of times that the program was context\-switched voluntarily,
for instance while waiting for an I/O operation to complete.
.IP x
Exit status of the command.
.RS
.SH EXAMPLES
To run the command `wc /etc/hosts' and show the default information:
time wc /etc/hosts
To run the command `ls \-Fs' and show just the user, system, and total
time:
time \-f "\et%E real,\et%U user,\et%S sys" ls \-Fs
To edit the file BORK and have `time' append the elapsed time and
number of signals to the file `log', reading the format string from the
environment variable `TIME':
export TIME="\et%E,\et%k" # If using bash or ksh
setenv TIME "\et%E,\et%k" # If using csh or tcsh
time \-a \-o log emacs bork
Users of the
.B bash
shell need to use an explicit path in order to run the external
.B time
command and not the shell builtin variant. On system where
.B time
is installed in
.IR /usr/bin ,
the first example would become
/usr/bin/time wc /etc/hosts
.SH ACCURACY
The elapsed time is not collected atomically with the execution of
the program; as a result, in bizarre circumstances (if the
.B time
command gets stopped or swapped out in between when the program being
timed exits and when
.B time
calculates how long it took to run), it
could be much larger than the actual execution time.
When the running time of a command is very nearly zero, some values
(e.g., the percentage of CPU used) may be reported as either zero (which
is wrong) or a question mark.
Most information shown by
.B time
is derived from the
.BR wait3 (2)
system call. The numbers are only as good as
those returned by
.BR wait3 (2).
On systems that do not have a
.BR wait3 (2)
call that returns status information, the
.BR times (2)
system call is used instead. However, it provides much less information than
.BR wait3 (2),
so on those systems
.B time
reports the majority of the resources as zero.
The `%I' and `%O' values are allegedly only `real' input and output
and do not include those supplied by caching devices. The meaning of
`real' I/O reported by `%I' and `%O' may be muddled for workstations,
especially diskless ones.
.SH DIAGNOSTICS
The
.B time
command returns when the program exits, stops, or is terminated by a signal.
If the program exited normally, the return value of
.B time
is the return value of the program it executed and measured. Otherwise, the
return value is 128 plus the number of the signal which caused the program to
stop or terminate.
.SH AUTHOR
.B time
was written by David MacKenzie. This man page was added by Dirk Eddelbuettel
<edd@debian.org>, the Debian GNU/Linux maintainer, for use by the Debian
GNU/Linux distribution but may of course be used by others.
.SH "SEE ALSO"
.BR tcsh (1),
.BR printf (3)

View File

@ -1,4 +1,45 @@
-------------------------------------------------------------------
Thu Sep 5 20:49:42 CEST 2013 - sbrabec@suse.cz
- Sync patches with Debian and Fedora:
* Add man page (time.1).
* Less nonverbose output (time-fedora-verbose.patch).
* Fix maximal RSS report
(time-fedora-ru_maxrss-is-in-kilobytes-on-Linux.patch,
bnc#836049, Redhat#702826).
* Switch to microsecond accuracy if miliseconds arithmetic rounds
to zero
(time-fedora-Recompute-CPU-usage-at-microsecond-level.patch,
Redhat#527276).
* When time exits in a non-normal way, return 128 plus the number
of the signal which caused time to stop or abort
(time-debian-non-normal-exit.patch).
* struct rusage and sys/resource.h portability fix
(time-debian-rusage-portability.patch, Debian#144819).
* Add -q,--quiet functionality
(time-debian-quiet.patch, Debian#56853).
* Update bug reporting address
(time-debian-bug-address.patch, Debian#542469).
* Modernize the configure.in file to current autoconf style
(time-debian-configure.patch).
* Add a directory entry to the info page
(time-debian-info-direntry.patch).
- Fix FSF address (time-fsf-address.patch).
- Update Summary.
- Rename time-1.7.diff to time-alpha.patch.
-------------------------------------------------------------------
Sun Jan 20 21:21:13 UTC 2013 - jengelh@inai.de
- Split "time" off util-linux
-------------------------------------------------------------------
Tue Feb 21 13:46:25 UTC 2012 - puzel@suse.com
- disabled make check for time (noop)
-------------------------------------------------------------------
Thu Oct 31 00:40:09 CET 2002 - ro@suse.de
- hack time to build on alpha

View File

@ -19,15 +19,49 @@
Name: time
Version: 1.7
Release: 0
Summary: Time a simple command or give resource usage
Summary: Run Programs And Summarize System Resource Usage
License: GPL-2.0+
Group: System/Base
Url: http://www.gnu.org/software/time/
Source: %name-%version.tar.bz2
Patch1: time-1.7.diff
Source: %{name}-%{version}.tar.bz2
# Sync with:
# Debian version: 1.7-24, patch naming: s/^/time-debian-/
# Fedora version: 1.7-44, patch naming: s/^time-1.7/^time-fedora/
# SOURCE-FEATURE-DEBIAN time.1 sbrabec@suse.cz -- Add time.1 man page.
Source1: time.1
# PATCH-FIX-OPENSUSE time-alpha.patch ro@suse.de -- Fix compilation on Alpha.
Patch1: time-alpha.patch
# PATCH-FIX-OPENSUSE time-fsf-address.patch sbrabec@suse.cz -- Fix FSF address.
Patch2: time-fsf-address.patch
# Patch10 time-fedora-destdir.patch not applied, use Debian patch and autoreconf instead
# PATCH-FEATURE-FEDORA time-fedora-verbose.patch sbrabec@suse.cz -- Roman Rakus <rrakus@redhat.cz> - 1.7-33 - Added patch from JW (redhat@zacglen.com), less nonverbose output.
Patch11: time-fedora-verbose.patch
# PATCH-FIX-FEDORA time-fedora-ru_maxrss-is-in-kilobytes-on-Linux.patch Redhat#702826 bnc#836049 sbrabec@suse.cz -- Petr Pisar <ppisar@redhat.com> - 1.7-39 - Fix maximal RSS report.
Patch12: time-fedora-ru_maxrss-is-in-kilobytes-on-Linux.patch
# Bug Redhat#527276 Recompute CPU usage at microsecond level
# PATCH-FEATURE-FEDORA time-fedora-Recompute-CPU-usage-at-microsecond-level.patch Redhat#527276 sbrabec@suse.cz -- H.J. Lu <hongjiu.lu@intel.com> - Switch to microsecond accuracy if miliseconds arithmetic rounds to zero.
Patch13: time-fedora-Recompute-CPU-usage-at-microsecond-level.patch
# PATCH-FIX-DEBIAN time-debian-non-normal-exit.patch sbrabec@suse.cz -- When time exits in a non-normal way, return 128 plus the number of the signal which caused time to stop or abort.
Patch20: time-debian-non-normal-exit.patch
# Patch21 time-debian-ru_maxrss.patch not applied, Fedora had it earlier.
# PATCH-FIX-DEBIAN time-debian-rusage-portability.patch Debian#144819 sbrabec@suse.cz -- struct rusage and sys/resource.h portability fix.
Patch22: time-debian-rusage-portability.patch
# PATCH-FEATURE-DEBIAN time-debian-quiet.patch Debian#56853 sbrabec@suse.cz -- Add -q,--quiet functionality.
Patch23: time-debian-quiet.patch
# PATCH-FIX-DEBIAN time-debian-bug-address.patch Debian#542469 sbrabec@suse.cz -- Update bug reporting address.
Patch24: time-debian-bug-address.patch
# PATCH-FIX-DEBIAN time-debian-configure.patch sbrabec@suse.cz -- Modernize the configure.in file to current autoconf style.
Patch25: time-debian-configure.patch
# PATCH-FEATURE-DEBIAN time-debian-info-direntry.patch sbrabec@suse.cz -- Add a directory entry to the info page.
Patch26: time-debian-info-direntry.patch
# PATCH-FEATURE-DEBIAN time-debian-info-nav.patch sbrabec@suse.cz -- Fix info navigation structure. Reported by Russ Allbery. Author: Bob Proulx.
Patch27: time-debian-info-nav.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: makeinfo
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: %install_info_prereq
# Split-provides for openSUSE <= 12.3 and SLE <= 11:
Provides: util-linux:/usr/bin/time
%description
@ -37,18 +71,29 @@ while the program was running.
%prep
%setup -q
%patch -P 1 -p1
cp -a %{S:1} ./
%patch1 -p1
%patch2 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch20 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%build
export CFLAGS="%optflags -D_GNU_SOURCE "
export INSTALL_PROGRAM='$(INSTALL)'
autoreconf -f -i
%configure
make %{?_smp_mflags}
%install
make install DESTDIR="%buildroot" prefix="%buildroot/%_prefix" \
bindir="%buildroot/%_bindir" mandir="%buildroot/%_mandir" \
infodir="%buildroot/%_infodir"
%makeinstall
install -d %{buildroot}%{_mandir}/man1
install -m 0644 time.1 %{buildroot}%{_mandir}/man1/time.1
%post
%install_info --entry="* time: (time). summarizing used system resources" --info-dir="%_infodir" "%_infodir/time.info.gz"
@ -58,8 +103,9 @@ make install DESTDIR="%buildroot" prefix="%buildroot/%_prefix" \
%files
%defattr(-,root,root)
%_bindir/time
%doc AUTHORS COPYING NEWS README
%_infodir/time.info*.gz
%{_bindir}/time
%{_infodir}/time.info*.gz
%{_mandir}/man1/time.*
%changelog