learn about v1 records.
This commit is contained in:
parent
e297758924
commit
14a515a88b
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dump.c,v 1.23 2005/08/19 02:09:22 christos Exp $ */
|
||||
/* $NetBSD: dump.c,v 1.24 2005/12/11 11:30:06 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1988, 1993
|
||||
|
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95";
|
||||
#endif
|
||||
__RCSID("$NetBSD: dump.c,v 1.23 2005/08/19 02:09:22 christos Exp $");
|
||||
__RCSID("$NetBSD: dump.c,v 1.24 2005/12/11 11:30:06 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -341,19 +341,46 @@ fread_tail(void *buf, int size, int num, FILE *fp)
|
|||
void
|
||||
dumpheader(struct ktr_header *kth)
|
||||
{
|
||||
static struct timeval prevtime;
|
||||
struct timeval temp;
|
||||
|
||||
wprintf("%6d %-8.*s ", kth->ktr_pid, MAXCOMLEN, kth->ktr_comm);
|
||||
union timeholder {
|
||||
struct timeval tv;
|
||||
struct timespec ts;
|
||||
};
|
||||
static union timeholder prevtime;
|
||||
union timeholder temp;
|
||||
|
||||
wprintf("%6d ", kth->ktr_pid);
|
||||
if (kth->ktr_version > KTRFACv0)
|
||||
wprintf("%6d ", kth->ktr_lid);
|
||||
wprintf("%-8.*s ", MAXCOMLEN, kth->ktr_comm);
|
||||
if (timestamp) {
|
||||
if (timestamp == 2) {
|
||||
timersub(&kth->ktr_time, &prevtime, &temp);
|
||||
prevtime = kth->ktr_time;
|
||||
} else
|
||||
temp = kth->ktr_time;
|
||||
wprintf("%ld.%06ld ",
|
||||
(long int)temp.tv_sec, (long int)temp.tv_usec);
|
||||
if (kth->ktr_version == KTRFACv0) {
|
||||
if (prevtime.tv.tv_sec == 0)
|
||||
temp.tv.tv_sec = temp.tv.tv_usec = 0;
|
||||
else
|
||||
timersub(&kth->ktr_tv,
|
||||
&prevtime.tv, &temp.tv);
|
||||
prevtime.tv = kth->ktr_tv;
|
||||
} else {
|
||||
if (prevtime.ts.tv_sec == 0)
|
||||
temp.ts.tv_sec = temp.ts.tv_nsec = 0;
|
||||
else
|
||||
timespecsub(&kth->ktr_time,
|
||||
&prevtime.ts, &temp.ts);
|
||||
prevtime.ts = kth->ktr_time;
|
||||
}
|
||||
} else {
|
||||
if (kth->ktr_version == KTRFACv0)
|
||||
temp.tv = kth->ktr_tv;
|
||||
else
|
||||
temp.ts = kth->ktr_time;
|
||||
}
|
||||
if (kth->ktr_version == KTRFACv0)
|
||||
wprintf("%ld.%06ld ",
|
||||
(long)temp.tv.tv_sec, (long)temp.tv.tv_usec);
|
||||
else
|
||||
wprintf("%ld.%09ld ",
|
||||
(long)temp.ts.tv_sec, (long)temp.ts.tv_nsec);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue