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] Initial SilabsTracing object #106

Merged
merged 5 commits into from
Nov 19, 2024

Conversation

lpbeliveau-silabs
Copy link
Contributor

@lpbeliveau-silabs lpbeliveau-silabs commented Nov 14, 2024

Initial Silabs Tracing object and unit tests. Next step: create silabs matter tracing backend object and integrate in our Base App / main

Class diagram graciously provided by Copilot:

classDiagram
    class SilabsTracer {
        +static SilabsTracer& Instance()
        +CHIP_ERROR Init()
        +CHIP_ERROR StartWatermarksStorage(PersistentStorageDelegate* storage)
        +void TimeTraceBegin(TimeTraceOperation aOperation)
        +void TimeTraceEnd(TimeTraceOperation aOperation, CHIP_ERROR error = CHIP_NO_ERROR)
        +void 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()
        +CHIP_ERROR GetTraceCount(size_t& count) const
        +CHIP_ERROR GetTraceByIndex(size_t index, const char*& trace) 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

…ests out of src/platformtests

Initial Silabs Tracing object and unit tests. Next step: create silabs  matter tracing backend object and integrate in our Base App / main
@lpbeliveau-silabs lpbeliveau-silabs requested a review from a team as a code owner November 14, 2024 17:17
examples/platform/silabs/silabs_utils.h Outdated Show resolved Hide resolved
src/platform/silabs/tracing/SilabsTracing.cpp Outdated Show resolved Hide resolved
src/platform/silabs/tracing/SilabsTracing.cpp Outdated Show resolved Hide resolved
src/platform/silabs/tracing/SilabsTracing.h Outdated Show resolved Hide resolved
src/platform/silabs/tracing/SilabsTracing.h Show resolved Hide resolved
@lpbeliveau-silabs lpbeliveau-silabs changed the title [SL-] Initial SilabsTracing object [SL-ONLY] Initial SilabsTracing object Nov 15, 2024
src/platform/silabs/tracing/BUILD.gn Show resolved Hide resolved
src/platform/silabs/tracing/BUILD.gn Show resolved Hide resolved
src/platform/silabs/tracing/SilabsTracing.cpp Outdated Show resolved Hide resolved
src/platform/silabs/tracing/SilabsTracing.cpp Show resolved Hide resolved
src/platform/silabs/tracing/SilabsTracing.cpp Show resolved Hide resolved
src/platform/silabs/tracing/SilabsTracing.cpp Show resolved Hide resolved
src/platform/silabs/tracing/SilabsTracing.h Show resolved Hide resolved
src/platform/silabs/tracing/SilabsTracing.h Show resolved Hide resolved
src/platform/tests/TestSilabsTracing.cpp Outdated Show resolved Hide resolved
@lpbeliveau-silabs lpbeliveau-silabs merged commit a70f40e into main Nov 19, 2024
13 checks passed
@lpbeliveau-silabs lpbeliveau-silabs deleted the feature/silabs_tracing branch November 19, 2024 00:58
@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
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.

4 participants