Help understanding triceRingBufferDepthMax diagnostic
The following logs shows Trice messages based on diagnostic. TriceWordCounter and TriceOverflowCounter are my implementations. All variables (except TriceOverflowCounter) are zeroed on each diagnostic report. All variables are acquired (and cleared) previous the diagnostic. All the following messages are consecutive:
TriceDiagnostic.c 123 25_006 TriceWordCounter = 17, TriceOverflowCounter = 0
TriceDiagnostic.c 127 25_006 triceSingleDepthMax = 32 of 120, SingleTricesRingCountMax = 4, triceRingBufferDepthMax = 124 of 600
TriceDiagnostic.c 123 30_007 TriceWordCounter = 15, TriceOverflowCounter = 0
TriceDiagnostic.c 127 30_007 triceSingleDepthMax = 32 of 120, SingleTricesRingCountMax = 4, triceRingBufferDepthMax = 124 of 600
Would be possible to clarify the triceRingBufferDepthMax ? I can't understand how these values match with the other values (eg: TriceWordCounter and triceSingleDepthMax vs SingleTricesRingCountMax) I can't make any calculation that will match. TriceWordCounter x 4=15 x 4=60=240 bytes != 124 bytes triceRingBufferDepthMax triceSingleDepthMax x SingleTricesRingCountMax = 32 x 4=128 != 124 bytes triceRingBufferDepthMax
TriceWordCounter is:
#define TRICE_DIAGNOSTICS_SINGLE_BUFFER do { \
unsigned wordCount = TriceBufferWritePosition - triceSingleBufferStartWritePosition; \
TriceWordCounter += wordCount; \
TriceSingleMaxWordCount = (wordCount < TriceSingleMaxWordCount) ? TriceSingleMaxWordCount : wordCount; \
} while(0);
Please check triceRingBuffer.c function TriceEnoughSpace in experimental branch now. It contains additional comments and a bug fix now. Could still not test it.
The changes are in main branch now. There is now a switch TRICE_PROTECT, defaulting to 1 and it protects against buffer overflows. Successfully tested in ./test/dblB_protect_de_tcobs_ua and ./test/ringB_protect_de_tcobs_ua. Please re-open this issue if there are remaining open questions.