mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-05 16:10:55 +00:00
Make -R',
-T' and `-E' options mutially non-exclusive. It is often
useful to see two or three types at the same time when inspecting the dump. MFC after: 1 month Sponsored by: Sippy Software, Inc.
This commit is contained in:
parent
0ab7a1f396
commit
c1269d2088
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=263756
|
@ -117,6 +117,11 @@ void limitfd(int fd);
|
||||||
void usage(void);
|
void usage(void);
|
||||||
void ioctlname(unsigned long, int);
|
void ioctlname(unsigned long, int);
|
||||||
|
|
||||||
|
#define TIMESTAMP_NONE 0x0
|
||||||
|
#define TIMESTAMP_ABSOLUTE 0x1
|
||||||
|
#define TIMESTAMP_ELAPSED 0x2
|
||||||
|
#define TIMESTAMP_RELATIVE 0x4
|
||||||
|
|
||||||
int timestamp, decimal, fancy = 1, suppressdata, tail, threads, maxdata,
|
int timestamp, decimal, fancy = 1, suppressdata, tail, threads, maxdata,
|
||||||
resolv = 0, abiflag = 0;
|
resolv = 0, abiflag = 0;
|
||||||
const char *tracefile = DEF_TRACEFILE;
|
const char *tracefile = DEF_TRACEFILE;
|
||||||
|
@ -254,6 +259,8 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
|
|
||||||
|
timestamp = TIMESTAMP_NONE;
|
||||||
|
|
||||||
while ((ch = getopt(argc,argv,"f:dElm:np:AHRrsTt:")) != -1)
|
while ((ch = getopt(argc,argv,"f:dElm:np:AHRrsTt:")) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'A':
|
case 'A':
|
||||||
|
@ -284,16 +291,16 @@ main(int argc, char *argv[])
|
||||||
suppressdata = 1;
|
suppressdata = 1;
|
||||||
break;
|
break;
|
||||||
case 'E':
|
case 'E':
|
||||||
timestamp = 3; /* elapsed timestamp */
|
timestamp |= TIMESTAMP_ELAPSED;
|
||||||
break;
|
break;
|
||||||
case 'H':
|
case 'H':
|
||||||
threads = 1;
|
threads = 1;
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
timestamp = 2; /* relative timestamp */
|
timestamp |= TIMESTAMP_RELATIVE;
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
timestamp = 1;
|
timestamp |= TIMESTAMP_ABSOLUTE;
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
trpoints = getpoints(optarg);
|
trpoints = getpoints(optarg);
|
||||||
|
@ -567,7 +574,7 @@ void
|
||||||
dumpheader(struct ktr_header *kth)
|
dumpheader(struct ktr_header *kth)
|
||||||
{
|
{
|
||||||
static char unknown[64];
|
static char unknown[64];
|
||||||
static struct timeval prevtime, temp;
|
static struct timeval prevtime, prevtime_e, temp;
|
||||||
const char *type;
|
const char *type;
|
||||||
|
|
||||||
switch (kth->ktr_type) {
|
switch (kth->ktr_type) {
|
||||||
|
@ -631,19 +638,26 @@ dumpheader(struct ktr_header *kth)
|
||||||
else
|
else
|
||||||
printf("%6jd %-8.*s ", (intmax_t)kth->ktr_pid, MAXCOMLEN,
|
printf("%6jd %-8.*s ", (intmax_t)kth->ktr_pid, MAXCOMLEN,
|
||||||
kth->ktr_comm);
|
kth->ktr_comm);
|
||||||
if (timestamp) {
|
if (timestamp) {
|
||||||
if (timestamp == 3) {
|
if (timestamp & TIMESTAMP_ABSOLUTE) {
|
||||||
if (prevtime.tv_sec == 0)
|
printf("%jd.%06ld ", (intmax_t)kth->ktr_time.tv_sec,
|
||||||
prevtime = kth->ktr_time;
|
kth->ktr_time.tv_usec);
|
||||||
timevalsub(&kth->ktr_time, &prevtime);
|
|
||||||
}
|
}
|
||||||
if (timestamp == 2) {
|
if (timestamp & TIMESTAMP_ELAPSED) {
|
||||||
|
if (prevtime_e.tv_sec == 0)
|
||||||
|
prevtime_e = kth->ktr_time;
|
||||||
|
timevalsub(&kth->ktr_time, &prevtime_e);
|
||||||
|
printf("%jd.%06ld ", (intmax_t)kth->ktr_time.tv_sec,
|
||||||
|
kth->ktr_time.tv_usec);
|
||||||
|
timevaladd(&kth->ktr_time, &prevtime_e);
|
||||||
|
}
|
||||||
|
if (timestamp & TIMESTAMP_RELATIVE) {
|
||||||
temp = kth->ktr_time;
|
temp = kth->ktr_time;
|
||||||
timevalsub(&kth->ktr_time, &prevtime);
|
timevalsub(&kth->ktr_time, &prevtime);
|
||||||
prevtime = temp;
|
prevtime = temp;
|
||||||
|
printf("%jd.%06ld ", (intmax_t)kth->ktr_time.tv_sec,
|
||||||
|
kth->ktr_time.tv_usec);
|
||||||
}
|
}
|
||||||
printf("%jd.%06ld ", (intmax_t)kth->ktr_time.tv_sec,
|
|
||||||
kth->ktr_time.tv_usec);
|
|
||||||
}
|
}
|
||||||
printf("%s ", type);
|
printf("%s ", type);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue