-
Notifications
You must be signed in to change notification settings - Fork 264
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
[common] add PerformanceTimer #893
Merged
Merged
+242
−1
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a114j0y
changed the title
add performancetimer into libswsscommon
swss-common/common: add PerformanceTimer
Jul 22, 2024
a114j0y
changed the title
swss-common/common: add PerformanceTimer
[common] add PerformanceTimer
Jul 22, 2024
This was referenced Jul 22, 2024
a114j0y
force-pushed
the
master
branch
8 times, most recently
from
July 29, 2024 20:59
50ac121
to
f9bc905
Compare
liuh-80
reviewed
Aug 26, 2024
a114j0y
force-pushed
the
master
branch
2 times, most recently
from
August 30, 2024 21:50
78108d0
to
213b741
Compare
qiluo-msft
reviewed
Sep 17, 2024
@qiluo-msft @liuh-80 @lguohan can you help to review and approve it? We need this util PR in for other loading time PRs. |
liuh-80
approved these changes
Nov 1, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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