ktrdump: ignore ts=0 when searching for earliest_ts()
authorSimon Schubert <corecode@dragonflybsd.org>
Thu, 30 Apr 2009 10:59:47 +0000 (12:59 +0200)
committerSimon Schubert <corecode@dragonflybsd.org>
Thu, 30 Apr 2009 10:59:47 +0000 (12:59 +0200)
commit10b4dde114c2040ad4e4ce4e804e9732d6936bc4
tree67f043a530218a9426438d7ff1f672b2013ad53b
parenta623c82da1a538a357c64db848194c92ca9f2710
ktrdump: ignore ts=0 when searching for earliest_ts()

When merge-printing multiple cpu buffers, we already treat ts=0 as
a condition to prefer a more recent entry.  However when searching for
the first entry, ts=0 (empty) will be treated regularly.  This can lead
to a situation that ktrdump would only print entries from the last CPU:

Assume you had 4 CPUs, and the buffer for CPU #2 and #3 started out with
empty entries (which would not be ignored by earliest_ts()).  When
searching for the next entry, the empty (ts=0) entry of CPU #2 would
always be selected as the first entry.  However a ts=0 entry of CPU #3
would override this.  In this case only the index of CPU #3 would
advance until full entries would be printed.  Once in this situation,
processing the ts of CPU #2 would always reset ts to 0, and this would
be treated as "not found" when processing CPU #3's entries, leading to
an output that only contains CPU #3 entries.
usr.bin/ktrdump/ktrdump.c