trice icon indicating copy to clipboard operation
trice copied to clipboard

add more and improve diagnostic

Open KammutierSpule opened this issue 1 year ago • 5 comments

Protect error count:

#if TRICE_DIAGNOSTICS == 1
        TriceErrorCount++;
#endif

Add overflow counter:

#if TRICE_DIAGNOSTICS == 1
    if( !isEnoughSpace ){
        TriceOverflowCounter++;
    }
#endif

//! Overflow counter
unsigned TriceOverflowCounter = 0;

Add word counter so we know / can verify the number of words inserted (it can be reset per diagnostic update)

//! Accumulate word counter
unsigned TriceWordCounter = 0;

#define TRICE_DIAGNOSTICS_SINGLE_BUFFER do { \
    unsigned wordCount = TriceBufferWritePosition - triceSingleBufferStartWritePosition; \
    TriceWordCounter += wordCount; \
    TriceSingleMaxWordCount = (wordCount < TriceSingleMaxWordCount) ? TriceSingleMaxWordCount : wordCount; \
    } while(0);

KammutierSpule avatar May 27 '24 10:05 KammutierSpule

TriceOverflowCounter is ok, see also #462. I cannot understand the value of the proposed TriceWordCounter. Please give an example.

rokath avatar Jun 03 '24 10:06 rokath

I cannot understand the value of the proposed TriceWordCounter. Pleas give an example.

TriceWordCounter, reseting it to 0 on very diagnostic update, it would be useful to better understand the amount of data of log produced during that time window. (maybe this could be also get indirectly by other statistics)

KammutierSpule avatar Jun 05 '24 14:06 KammutierSpule

Maybe you mean the used max depth of a double half buffer or the max depth of the ring buffer with the expression "TriceWordCounter"? That is a very important metric and available when enabling TRICE_DIAGNOSTICS.

rokath avatar Jun 05 '24 18:06 rokath

Maybe you mean the used max depth of a double half buffer or the max depth of the ring buffer with the expression "TriceWordCounter"? That is a very important metric and available when enabling TRICE_DIAGNOSTICS.

I'm thinking / trying to remember .. :)

TriceWordCounter, reseting it to 0 on very diagnostic update, it would be useful to better understand the amount of data of log produced during that time window.

What I mean is, the "max depth" only mean that (as the depth can change between diagnostic reports), TriceWordCounter would mean the total "traffic" that happened during the diagnostic report. Note that on my code I'm resetting to 0 this diagnostic data.

So "max depth" != TriceWordCounter

Eg: a small "max depth" and a TriceWordCounter high means that lots of Trice entries were added but also dispatched.

KammutierSpule avatar Jun 05 '24 18:06 KammutierSpule

Not really convinced, so far. A traffic measurement could be done by the Trice tool and should not be a task of the embedded device. Also it is not clear what to measure: The Trice netto data? The framed data, with or without 0-delimiters? Simply the Trice count? We could extend the trice tool for that. The easiest way would be to add it to the statistics when shutting down the tool.

rokath avatar Jun 07 '24 14:06 rokath

In main branch now is a separate file ./examples/exampleData/triceLogDiagnosticData.c which contains also the overflow counters for TRICE_PROTECT.

rokath avatar Jul 16 '24 21:07 rokath