Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SL-ONLY] Feature/silabs tracing logs formating #114

Merged
merged 4 commits into from
Nov 20, 2024

Conversation

lpbeliveau-silabs
Copy link
Contributor

Reworked the logging, added some tests for the formatting, the error generation and the buffer handling.

Yes we are merging on main, this was a mistake I made when I made the previous one, I'll fix it tomorrow probably.

Here's an updated class diagram for all the diagram lovers out there:

classDiagram
    class SilabsTracer {
        +static SilabsTracer& Instance()
        +CHIP_ERROR Init()
        +CHIP_ERROR StartWatermarksStorage(PersistentStorageDelegate* storage)
        +CHIP_ERROR TimeTraceBegin(TimeTraceOperation aOperation)
        +CHIP_ERROR TimeTraceEnd(TimeTraceOperation aOperation, CHIP_ERROR error = CHIP_NO_ERROR)
        +CHIP_ERROR TimeTraceInstant(TimeTraceOperation aOperation, CHIP_ERROR error = CHIP_NO_ERROR)
        +CHIP_ERROR OutputTimeTracker(const TimeTracker& tracker)
        +CHIP_ERROR OutputWaterMark(TimeTraceOperation aOperation)
        +CHIP_ERROR OutputAllWaterMarks()
        +CHIP_ERROR TraceBufferFlushAll()
        +CHIP_ERROR TraceBufferFlushByOperation(TimeTraceOperation aOperation)
        +TimeTracker GetTimeTracker(TimeTraceOperation aOperation)
        +Watermark GetWatermark(TimeTraceOperation aOperation)
        +CHIP_ERROR SaveWatermarks()
        +CHIP_ERROR LoadWatermarks()
        +size_t GetTimeTracesCount()
        +CHIP_ERROR GetTraceByOperation(TimeTraceOperation aOperation, char * buffer, size_t & size) const
        -void TraceBufferClear()
        -CHIP_ERROR OutputTrace(const TimeTracker& tracker)
        -static SilabsTracer sInstance
        -TimeTrackerList mTimeTrackerList
        -TimeTracker mLatestTimeTrackers[kNumTraces]
        -Watermark mWatermarks[kNumTraces]
        -PersistentStorageDelegate* mStorage
        -size_t mBufferedTrackerCount
    }

    class TimeTracker {
        +System::Clock::Milliseconds32 mStartTime
        +System::Clock::Milliseconds32 mEndTime
        +TimeTraceOperation mOperation
        +OperationType mType
        +CHIP_ERROR mError
    }

    class Watermark {
        +System::Clock::Milliseconds32 mMovingAverage
        +System::Clock::Milliseconds32 mMaxTimeMs
        +System::Clock::Milliseconds32 mMinTimeMs
        +uint32_t mTotalCount
        +uint32_t mSuccessfullCount
        +uint32_t mCountAboveAvg
    }

    class TimeTrackerList {
        +chip::SingleLinkedListNode* head
        +void Insert(const TimeTracker& tracker)
        +void Remove(size_t index)
    }

    class SingleLinkedListNode {
        +TimeTracker mValue
        +SingleLinkedListNode* mpNext
    }

    SilabsTracer --> TimeTracker
    SilabsTracer --> Watermark
    SilabsTracer --> TimeTrackerList
    TimeTrackerList --> SingleLinkedListNode
    SingleLinkedListNode --> TimeTracker
Loading

@lpbeliveau-silabs lpbeliveau-silabs requested a review from a team as a code owner November 19, 2024 01:23
@lpbeliveau-silabs lpbeliveau-silabs force-pushed the feature/silabs_tracing_logs_formating branch from 9683361 to a3d4813 Compare November 19, 2024 13:13
@lpbeliveau-silabs lpbeliveau-silabs force-pushed the feature/silabs_tracing_logs_formating branch from a3d4813 to 4846604 Compare November 19, 2024 13:59
@mkardous-silabs mkardous-silabs added the sl-only This TAG indicates that this commit is a silabs-specific commit that cannot be upstream to CSA. label Nov 19, 2024
@lpbeliveau-silabs lpbeliveau-silabs merged commit 9bf974a into main Nov 20, 2024
13 checks passed
@lpbeliveau-silabs lpbeliveau-silabs deleted the feature/silabs_tracing_logs_formating branch November 20, 2024 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sl-only This TAG indicates that this commit is a silabs-specific commit that cannot be upstream to CSA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants