o Properly init prevtime, so that we don't print bogus value in the
first entry reported by the relative mode (-R). o Properly print negative offsets, which I guess may happen if records get re-ordered somehow, possibly due to the locking. Right now we report huge bogus diff (i.e. 2 seconds or so).
This commit is contained in:
parent
fba6933f6e
commit
da551bb2c2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=281970
@ -586,6 +586,7 @@ dumpheader(struct ktr_header *kth)
|
||||
static char unknown[64];
|
||||
static struct timeval prevtime, prevtime_e, temp;
|
||||
const char *type;
|
||||
const char *sign;
|
||||
|
||||
switch (kth->ktr_type) {
|
||||
case KTR_SYSCALL:
|
||||
@ -662,10 +663,20 @@ dumpheader(struct ktr_header *kth)
|
||||
timevaladd(&kth->ktr_time, &prevtime_e);
|
||||
}
|
||||
if (timestamp & TIMESTAMP_RELATIVE) {
|
||||
if (prevtime.tv_sec == 0)
|
||||
prevtime = kth->ktr_time;
|
||||
temp = kth->ktr_time;
|
||||
timevalsub(&kth->ktr_time, &prevtime);
|
||||
prevtime = temp;
|
||||
printf("%jd.%06ld ", (intmax_t)kth->ktr_time.tv_sec,
|
||||
if ((intmax_t)kth->ktr_time.tv_sec < 0) {
|
||||
kth->ktr_time = prevtime;
|
||||
prevtime = temp;
|
||||
timevalsub(&kth->ktr_time, &prevtime);
|
||||
sign = "-";
|
||||
} else {
|
||||
prevtime = temp;
|
||||
sign = "";
|
||||
}
|
||||
printf("%s%jd.%06ld ", sign, (intmax_t)kth->ktr_time.tv_sec,
|
||||
kth->ktr_time.tv_usec);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user