4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
24 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
28 #pragma ident "%Z%%M% %I% %E% SMI"
36 #include <sys/types.h>
38 #include <sys/resource.h>
48 (void) fprintf(stderr
, gettext("%d.%02d %s "),
49 tv
->tv_sec
, tv
->tv_usec
/10000, s
);
53 main(int argc
, char **argv
)
58 struct timeval before
, after
;
62 (void) setlocale(LC_ALL
, "");
64 #if !defined(TEXT_DOMAIN)
65 #define TEXT_DOMAIN "SYS_TEST"
67 (void) textdomain(TEXT_DOMAIN
);
71 (void) gettimeofday(&before
, &tz
);
73 /* fork a child process to run the command */
83 /* exec the command specified */
85 execvp(argv
[1], &argv
[1]);
90 /* parent code - wait for command to complete */
92 (void) signal(SIGINT
, SIG_IGN
);
93 (void) signal(SIGQUIT
, SIG_IGN
);
94 while (wait3(&status
.w_status
, options
, &ru
) != p
)
97 /* get closing time of day */
98 (void) gettimeofday(&after
, &tz
);
100 /* check for exit status of command */
102 if ((status
.w_termsig
) != 0)
103 (void) fprintf(stderr
,
104 gettext("Command terminated abnormally.\n"));
106 /* print an accounting summary line */
108 after
.tv_sec
-= before
.tv_sec
;
109 after
.tv_usec
-= before
.tv_usec
;
110 if (after
.tv_usec
< 0) {
112 after
.tv_usec
+= 1000000;
114 fprintt(gettext("real"), &after
);
115 fprintt(gettext("user"), &ru
.ru_utime
);
116 fprintt(gettext("sys"), &ru
.ru_stime
);
117 (void) fprintf(stderr
, gettext("%d pf %d pr %d sw"),
121 (void) fprintf(stderr
, gettext(" %d rb %d wb %d vcx %d icx"),
126 (void) fprintf(stderr
, gettext(" %d mx %d ix %d id %d is"),
132 (void) fprintf(stderr
, "\n");
133 return ((int)status
.w_retcode
);