PERFORCE change 43344 for review

Peter Wemm peter at FreeBSD.org
Tue Dec 2 18:47:37 PST 2003


http://perforce.freebsd.org/chv.cgi?CH=43344

Change 43344 by peter at peter_overcee on 2003/12/02 18:47:17

	capture this before I lose it too.  Add -E (elapsed) time stamps.
	This is IMHO more useful than both -R and/or -T.

Affected files ...

.. //depot/projects/hammer/usr.bin/kdump/kdump.1#3 edit
.. //depot/projects/hammer/usr.bin/kdump/kdump.c#6 edit

Differences ...

==== //depot/projects/hammer/usr.bin/kdump/kdump.1#3 (text+ko) ====

@@ -40,7 +40,7 @@
 .Nd display kernel trace data
 .Sh SYNOPSIS
 .Nm
-.Op Fl dnlRT
+.Op Fl dnlERT
 .Op Fl f Ar file
 .Op Fl m Ar maxdata
 .Op Fl p Ar pid
@@ -89,6 +89,8 @@
 .Ar pid .
 This may be useful when there are multiple processes recorded in the
 same trace file.
+.It Fl E
+Display elapsed timestamps (time since beginning of trace).
 .It Fl R
 Display relative timestamps (time since previous entry).
 .It Fl T

==== //depot/projects/hammer/usr.bin/kdump/kdump.c#6 (text+ko) ====

@@ -97,7 +97,7 @@
 
 	(void) setlocale(LC_CTYPE, "");
 
-	while ((ch = getopt(argc,argv,"f:dlm:np:RTt:")) != -1)
+	while ((ch = getopt(argc,argv,"f:dlm:np:ERTt:")) != -1)
 		switch((char)ch) {
 		case 'f':
 			tracefile = optarg;
@@ -117,6 +117,9 @@
 		case 'p':
 			pid = atoi(optarg);
 			break;
+		case 'E':
+			timestamp = 3;	/* elapsed timestamp */
+			break;
 		case 'R':
 			timestamp = 2;	/* relative timestamp */
 			break;
@@ -249,6 +252,11 @@
 
 	(void)printf("%6d %-8.*s ", kth->ktr_pid, MAXCOMLEN, kth->ktr_comm);
 	if (timestamp) {
+		if (timestamp == 3) {
+			if (prevtime.tv_sec == 0)
+				prevtime = kth->ktr_time;
+			timevalsub(&kth->ktr_time, &prevtime);
+		}
 		if (timestamp == 2) {
 			temp = kth->ktr_time;
 			timevalsub(&kth->ktr_time, &prevtime);


More information about the p4-projects mailing list