Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What I did
Extend the
PerformanceIntervalTimer
utility insonic-sairedis
repo to measure API performance.To optimize performance of a periodically invoked function, we not only pay attention to how long it takes to finish execution (busy time), but also care about how long it waits to get executed (idle time). The total time determines the actual throughput in the real world system.
Hence we want to see data in 3 ways:
Idle
time between two calls (a gap between this start and the last end, during which the thread just waits)Busy
time of each API call (interval between this start and this end, it's the true execution time)Total
time elapsed (idle + busy)| <- Initial Gap -> | <- - 1st **Execution** - -> | <- 2nd Gap -> | <- - 2nd **Execution** - -> |
| <---------------- 1st **Total** --------------> | <------------ 2nd **Total**--------------> |
Other features
SWSSLOGLEVEL
using a file indicator, default level is "INFO", hence we could enable perf logs in a dynamic way.Why I did it
original utility has limited functionality
original utility is in libsairedis, to use it in sonic-swss, there would be much Makefile.am change, not necessary.
a utility tool for swss should be included in swss-common
when enabled on-demand, it could help measure the API performance under scaled traffic