From owner-svn-src-all@FreeBSD.ORG Sat Apr 25 04:58:09 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 55C4663B; Sat, 25 Apr 2015 04:58:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 445C110DB; Sat, 25 Apr 2015 04:58:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3P4w9Ci059238; Sat, 25 Apr 2015 04:58:09 GMT (envelope-from sobomax@FreeBSD.org) Received: (from sobomax@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3P4w9Rw059237; Sat, 25 Apr 2015 04:58:09 GMT (envelope-from sobomax@FreeBSD.org) Message-Id: <201504250458.t3P4w9Rw059237@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: sobomax set sender to sobomax@FreeBSD.org using -f From: Maxim Sobolev Date: Sat, 25 Apr 2015 04:58:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r281970 - head/usr.bin/kdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Apr 2015 04:58:09 -0000 Author: sobomax Date: Sat Apr 25 04:58:08 2015 New Revision: 281970 URL: https://svnweb.freebsd.org/changeset/base/281970 Log: o Properly init prevtime, so that we don't print bogus value in the first entry reported by the relative mode (-R). o Properly print negative offsets, which I guess may happen if records get re-ordered somehow, possibly due to the locking. Right now we report huge bogus diff (i.e. 2 seconds or so). Modified: head/usr.bin/kdump/kdump.c Modified: head/usr.bin/kdump/kdump.c ============================================================================== --- head/usr.bin/kdump/kdump.c Sat Apr 25 04:49:45 2015 (r281969) +++ head/usr.bin/kdump/kdump.c Sat Apr 25 04:58:08 2015 (r281970) @@ -586,6 +586,7 @@ dumpheader(struct ktr_header *kth) static char unknown[64]; static struct timeval prevtime, prevtime_e, temp; const char *type; + const char *sign; switch (kth->ktr_type) { case KTR_SYSCALL: @@ -662,10 +663,20 @@ dumpheader(struct ktr_header *kth) timevaladd(&kth->ktr_time, &prevtime_e); } if (timestamp & TIMESTAMP_RELATIVE) { + if (prevtime.tv_sec == 0) + prevtime = kth->ktr_time; temp = kth->ktr_time; timevalsub(&kth->ktr_time, &prevtime); - prevtime = temp; - printf("%jd.%06ld ", (intmax_t)kth->ktr_time.tv_sec, + if ((intmax_t)kth->ktr_time.tv_sec < 0) { + kth->ktr_time = prevtime; + prevtime = temp; + timevalsub(&kth->ktr_time, &prevtime); + sign = "-"; + } else { + prevtime = temp; + sign = ""; + } + printf("%s%jd.%06ld ", sign, (intmax_t)kth->ktr_time.tv_sec, kth->ktr_time.tv_usec); } }