summaryrefslogtreecommitdiffstats
path: root/bin/ps/print.c
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2010-03-17 22:57:58 +0000
committerjmallett <jmallett@FreeBSD.org>2010-03-17 22:57:58 +0000
commitd27802f97a217c556ca63d8df9ebc1b6d15ccd19 (patch)
tree231aea4c64247be505190e35fe0e7ae410703755 /bin/ps/print.c
parentb55593dee5f64317be6472d0338098432211dbe4 (diff)
downloadFreeBSD-src-d27802f97a217c556ca63d8df9ebc1b6d15ccd19.zip
FreeBSD-src-d27802f97a217c556ca63d8df9ebc1b6d15ccd19.tar.gz
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
Diffstat (limited to 'bin/ps/print.c')
-rw-r--r--bin/ps/print.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c
index aa4f98f..cc33cdd 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -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)
{
OpenPOWER on IntegriCloud