ptime.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include <wait.h>
#include <signal.h>
#include <signal.h>
#include <libproc.h>
static void hr_min_sec(char *, long);
static void prtime(char *, timestruc_t *);
static int perr(const char *);
static char *command;
static char procname[64];
int
{
int status;
command++;
else
if (argc <= 1) {
"usage:\t%s command [ args ... ]\n", command);
" (time a command using microstate accounting)\n");
return (1);
}
case -1:
return (2);
case 0:
}
return (WEXITSTATUS(status));
if (WIFSIGNALED(status)) {
char name[SIG2STR_MAX];
}
}
static int
{
char pathname[100];
int rval = 0;
int fd;
return (perr("read psinfo"));
return (perr("open usage"));
else {
}
return (rval);
}
static void
{
if (sec >= 3600)
else if (sec >= 60)
else
}
static void
{
char buf[32];
}
static int
perr(const char *s)
{
if (s)
else
s = procname;
perror(s);
return (1);
}
static void
{
}
}
static void
{
}
}