ok Ted Unangst([email protected]) on 2016.06.01 13:41:01 -0400: > Relative timestamps are much easier to decipher than absolute, when attempting > to determine a program's behavior. Most of the time I care about how long > since the last time. However, if I grep the output, then I lose the basis for > relative times, and am back to doing large number substraction in my head. > > What I really want in many cases, is timestamps relative to the start of the > trace. I didn't know what letter to pick, so since I want a mix of T and R, I > just made the option be both together. > > > Index: kdump.c > =================================================================== > RCS file: /cvs/src/usr.bin/kdump/kdump.c,v > retrieving revision 1.127 > diff -u -p -r1.127 kdump.c > --- kdump.c 30 Mar 2016 08:00:01 -0000 1.127 > +++ kdump.c 1 Jun 2016 17:34:29 -0000 > @@ -185,11 +185,11 @@ main(int argc, char *argv[]) > if (errstr) > errx(1, "-p %s: %s", optarg, errstr); > break; > - case 'R': > - timestamp = 2; /* relative timestamp */ > + case 'R': /* relative timestamp */ > + timestamp = timestamp == 1 ? 3 : 2; > break; > case 'T': > - timestamp = 1; > + timestamp = timestamp == 2 ? 3 : 1; > break; > case 't': > trpoints = getpoints(optarg); > @@ -349,7 +349,11 @@ dumpheader(struct ktr_header *kth) > basecol += printf("/%-7ld", (long)kth->ktr_tid); > basecol += printf(" %-8.*s ", MAXCOMLEN, kth->ktr_comm); > if (timestamp) { > - if (timestamp == 2) { > + if (timestamp == 3) { > + if (prevtime.tv_sec == 0) > + prevtime = kth->ktr_time; > + timespecsub(&kth->ktr_time, &prevtime, &temp); > + } else if (timestamp == 2) { > timespecsub(&kth->ktr_time, &prevtime, &temp); > prevtime = kth->ktr_time; > } else > Index: kdump.1 > =================================================================== > RCS file: /cvs/src/usr.bin/kdump/kdump.1,v > retrieving revision 1.30 > diff -u -p -r1.30 kdump.1 > --- kdump.1 6 Mar 2016 20:25:27 -0000 1.30 > +++ kdump.1 1 Jun 2016 17:39:24 -0000 > @@ -92,6 +92,8 @@ specified. > Display relative timestamps (time since previous entry). > .It Fl T > Display absolute timestamps for each entry (seconds since the Epoch). > +.It Fl TR > +If both options are specified, display timestamps relative to trace start. > .It Fl t Op Cm cinstuxX+ > Selects which tracepoints to display. > See the >
--
