summaryrefslogtreecommitdiffstats
path: root/usr.bin/kdump
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2003-12-07 01:06:32 +0000
committerpeter <peter@FreeBSD.org>2003-12-07 01:06:32 +0000
commit770241da4d3fee925ef927bae3f6a5652091bf92 (patch)
tree8704c58d045b2bbd6b6b8a5423a2f2614dcdea41 /usr.bin/kdump
parent0c52ba9c046a46b8087bb1ac2ed981fdeff1aace (diff)
downloadFreeBSD-src-770241da4d3fee925ef927bae3f6a5652091bf92.zip
FreeBSD-src-770241da4d3fee925ef927bae3f6a5652091bf92.tar.gz
Add a -E (elapsed time) flag to kdump. This is like -T, except it is
relative to start of the dump. Approved by: re (scottl)
Diffstat (limited to 'usr.bin/kdump')
-rw-r--r--usr.bin/kdump/kdump.14
-rw-r--r--usr.bin/kdump/kdump.c10
2 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/kdump/kdump.1 b/usr.bin/kdump/kdump.1
index c48b86b..f51fbdd 100644
--- a/usr.bin/kdump/kdump.1
+++ b/usr.bin/kdump/kdump.1
@@ -40,7 +40,7 @@
.Nd display kernel trace data
.Sh SYNOPSIS
.Nm
-.Op Fl dnlRT
+.Op Fl dnlERT
.Op Fl f Ar file
.Op Fl m Ar maxdata
.Op Fl p Ar pid
@@ -89,6 +89,8 @@ Display only trace events that correspond to the process
.Ar pid .
This may be useful when there are multiple processes recorded in the
same trace file.
+.It Fl E
+Display elapsed timestamps (time since beginning of trace).
.It Fl R
Display relative timestamps (time since previous entry).
.It Fl T
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index ec54ece..397f97c 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -97,7 +97,7 @@ main(int argc, char *argv[])
(void) setlocale(LC_CTYPE, "");
- while ((ch = getopt(argc,argv,"f:dlm:np:RTt:")) != -1)
+ while ((ch = getopt(argc,argv,"f:dlm:np:ERTt:")) != -1)
switch((char)ch) {
case 'f':
tracefile = optarg;
@@ -117,6 +117,9 @@ main(int argc, char *argv[])
case 'p':
pid = atoi(optarg);
break;
+ case 'E':
+ timestamp = 3; /* elapsed timestamp */
+ break;
case 'R':
timestamp = 2; /* relative timestamp */
break;
@@ -249,6 +252,11 @@ dumpheader(struct ktr_header *kth)
(void)printf("%6d %-8.*s ", kth->ktr_pid, MAXCOMLEN, kth->ktr_comm);
if (timestamp) {
+ if (timestamp == 3) {
+ if (prevtime.tv_sec == 0)
+ prevtime = kth->ktr_time;
+ timevalsub(&kth->ktr_time, &prevtime);
+ }
if (timestamp == 2) {
temp = kth->ktr_time;
timevalsub(&kth->ktr_time, &prevtime);
OpenPOWER on IntegriCloud