Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jan 2011 06:36:14 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r217873 - head/usr.bin/ktrdump
Message-ID:  <201101260636.p0Q6aE5j065922@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Wed Jan 26 06:36:14 2011
New Revision: 217873
URL: http://svn.freebsd.org/changeset/base/217873

Log:
  Add -H flag to print thread id.

Modified:
  head/usr.bin/ktrdump/ktrdump.8
  head/usr.bin/ktrdump/ktrdump.c

Modified: head/usr.bin/ktrdump/ktrdump.8
==============================================================================
--- head/usr.bin/ktrdump/ktrdump.8	Wed Jan 26 06:07:24 2011	(r217872)
+++ head/usr.bin/ktrdump/ktrdump.8	Wed Jan 26 06:36:14 2011	(r217873)
@@ -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 head
 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

Modified: head/usr.bin/ktrdump/ktrdump.c
==============================================================================
--- head/usr.bin/ktrdump/ktrdump.c	Wed Jan 26 06:07:24 2011	(r217872)
+++ head/usr.bin/ktrdump/ktrdump.c	Wed Jan 26 06:36:14 2011	(r217873)
@@ -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");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101260636.p0Q6aE5j065922>