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)
This commit is contained in:
parent
c5cc93f9ca
commit
ec13191464
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user