summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authordchagin <dchagin@FreeBSD.org>2011-01-26 06:36:14 +0000
committerdchagin <dchagin@FreeBSD.org>2011-01-26 06:36:14 +0000
commita553f5bca5636375477f3d88822ed41b34867fba (patch)
tree5bc40e5af7b0a32c6c34b2b363d8d4723db932e6 /usr.bin
parent206a92c4962f911b031886c06b06b1246f110542 (diff)
downloadFreeBSD-src-a553f5bca5636375477f3d88822ed41b34867fba.zip
FreeBSD-src-a553f5bca5636375477f3d88822ed41b34867fba.tar.gz
Add -H flag to print thread id.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ktrdump/ktrdump.84
-rw-r--r--usr.bin/ktrdump/ktrdump.c14
2 files changed, 15 insertions, 3 deletions
diff --git a/usr.bin/ktrdump/ktrdump.8 b/usr.bin/ktrdump/ktrdump.8
index 1e0e8c9..9a77bfc 100644
--- a/usr.bin/ktrdump/ktrdump.8
+++ b/usr.bin/ktrdump/ktrdump.8
@@ -33,7 +33,7 @@
.Nd print kernel ktr trace buffer
.Sh SYNOPSIS
.Nm
-.Op Fl cfqrt
+.Op Fl cfqrtH
.Op Fl e Ar execfile
.Op Fl i Ar ktrfile
.Op Fl m Ar corefile
@@ -55,6 +55,8 @@ Quiet mode; do not print the column header.
Print relative timestamps rather than absolute timestamps.
.It Fl t
Print the timestamp for each entry.
+.It Fl H
+Print the thread ID for each entry.
.It Fl i Ar ktrfile
File containing saved ktr trace events; for more information see the
.Xr ktr 4
diff --git a/usr.bin/ktrdump/ktrdump.c b/usr.bin/ktrdump/ktrdump.c
index c700526..5129545 100644
--- a/usr.bin/ktrdump/ktrdump.c
+++ b/usr.bin/ktrdump/ktrdump.c
@@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
#define SBUFLEN 128
#define USAGE \
- "usage: ktrdump [-cfqrt] [-e execfile] [-i ktrfile] [-m corefile] [-o outfile]\n"
+ "usage: ktrdump [-cfqrtH] [-e execfile] [-i ktrfile] [-m corefile] [-o outfile]\n"
static void usage(void);
@@ -66,6 +66,7 @@ static int qflag;
static int rflag;
static int tflag;
static int iflag;
+static int hflag;
static char corefile[PATH_MAX];
static char execfile[PATH_MAX];
@@ -101,7 +102,7 @@ main(int ac, char **av)
* Parse commandline arguments.
*/
out = stdout;
- while ((c = getopt(ac, av, "cfqrte:i:m:o:")) != -1)
+ while ((c = getopt(ac, av, "cfqrtHe:i:m:o:")) != -1)
switch (c) {
case 'c':
cflag = 1;
@@ -139,6 +140,9 @@ main(int ac, char **av)
case 't':
tflag = 1;
break;
+ case 'H':
+ hflag = 1;
+ break;
case '?':
default:
usage();
@@ -191,6 +195,8 @@ main(int ac, char **av)
fprintf(out, "%-16s ", "timestamp");
if (fflag)
fprintf(out, "%-40s ", "file and line");
+ if (hflag)
+ fprintf(out, "%-18s ", "tid");
fprintf(out, "%s", "trace");
fprintf(out, "\n");
@@ -202,6 +208,8 @@ main(int ac, char **av)
if (fflag)
fprintf(out,
"---------------------------------------- ");
+ if (hflag)
+ fprintf(out, "------------------ ");
fprintf(out, "----- ");
fprintf(out, "\n");
}
@@ -270,6 +278,8 @@ next: if ((c = *p++) == '\0')
buf[i].ktr_line);
fprintf(out, "%-40s ", obuf);
}
+ if (hflag)
+ fprintf(out, "%p ", buf[i].ktr_thread);
fprintf(out, desc, parms[0], parms[1], parms[2], parms[3],
parms[4], parms[5]);
fprintf(out, "\n");
OpenPOWER on IntegriCloud