o) Add a keyword to displaying elapsed time in integer seconds, "etimes".
o) Give slightly better (i.e. any) documentation of the format of "etime". Reviewed by: jilles
This commit is contained in:
parent
c0df07cad9
commit
41ded75de8
@ -48,6 +48,7 @@ void command(KINFO *, VARENT *);
|
||||
void cputime(KINFO *, VARENT *);
|
||||
int donlist(void);
|
||||
void elapsed(KINFO *, VARENT *);
|
||||
void elapseds(KINFO *, VARENT *);
|
||||
void emulname(KINFO *, VARENT *);
|
||||
VARENT *find_varentry(VAR *);
|
||||
const char *fmt_argv(char **, char *, size_t);
|
||||
|
@ -89,6 +89,7 @@ static VAR var[] = {
|
||||
{"emul", "EMUL", NULL, LJUST, emulname, NULL, EMULLEN, 0, CHAR,
|
||||
NULL, 0},
|
||||
{"etime", "ELAPSED", NULL, USER, elapsed, NULL, 12, 0, CHAR, NULL, 0},
|
||||
{"etimes", "ELAPSED", NULL, USER, elapseds, NULL, 12, 0, CHAR, NULL, 0},
|
||||
{"f", "F", NULL, 0, kvar, NULL, 7, KOFF(ki_flag), INT, "x", 0},
|
||||
{"flags", "", "f", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
|
||||
{"ignored", "", "sigignore", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
|
||||
|
@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <nlist.h>
|
||||
#include <pwd.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -618,6 +619,21 @@ elapsed(KINFO *k, VARENT *ve)
|
||||
(void)printf("%*s", v->width, obuff);
|
||||
}
|
||||
|
||||
void
|
||||
elapseds(KINFO *k, VARENT *ve)
|
||||
{
|
||||
VAR *v;
|
||||
time_t val;
|
||||
|
||||
v = ve->var;
|
||||
if (!k->ki_valid) {
|
||||
(void)printf("%-*s", v->width, "-");
|
||||
return;
|
||||
}
|
||||
val = now - k->ki_p->ki_start.tv_sec;
|
||||
(void)printf("%*jd", v->width, (intmax_t)val);
|
||||
}
|
||||
|
||||
double
|
||||
getpcpu(const KINFO *k)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@
|
||||
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd March 5, 2010
|
||||
.Dd March 17, 2010
|
||||
.Dt PS 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -479,7 +479,12 @@ command and arguments
|
||||
.It Cm cpu
|
||||
short-term CPU usage factor (for scheduling)
|
||||
.It Cm etime
|
||||
elapsed running time
|
||||
elapsed running time, format
|
||||
.Op days- Ns
|
||||
.Op hours: Ns
|
||||
minutes:seconds.
|
||||
.It Cm etimes
|
||||
elapsed running time, in decimal integer seconds
|
||||
.It Cm flags
|
||||
the process flags, in hexadecimal (alias
|
||||
.Cm f )
|
||||
|
Loading…
x
Reference in New Issue
Block a user