debugtrace: add entry when entry count is wrapping
authorJuergen Gross <jgross@suse.com>
Thu, 12 Sep 2019 13:13:47 +0000 (15:13 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 12 Sep 2019 13:13:47 +0000 (15:13 +0200)
commitc82425e456ff04f727e252458abcaef76ef20045
tree2f13e18f4547f32c2b26d5b651b3654d1924321c
parent6338c9ead9ff9ef6b3197b0b401484f5323cabd3
debugtrace: add entry when entry count is wrapping

The debugtrace entry count is a 32 bit variable, so it can wrap when
lots of trace entries are being produced. Making it wider would result
in a waste of buffer space as the printed count value would consume
more bytes when not wrapping.

So instead of letting the count value grow to huge values let it wrap
and add a wrap counter printed in this situation. This will keep the
needed buffer space at today's value while avoiding to loose a way to
sort all entries in case multiple trace buffers are involved.

Note that the wrap message will be printed before the first trace
entry in case output is switched to console early. This is on purpose
in order to enable a future support of debugtrace to console without
any allocated buffer.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/common/debugtrace.c