-
Notifications
You must be signed in to change notification settings - Fork 693
Add buffer pool watermark support #853
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
34822e2
Write fields to FLEX_COUNTER_GROUP_TABLE at the construction of
wendani 7f2050f
Update buffer pool name to oid mapping in COUNTERS_DB upon the set an…
wendani 959c38f
Push buffer pool watermark COUNTER_ID_LIST to FLEX_COUNTER_TABLE
wendani 8f080bf
Implement user clear logic to buffer pool watermark
wendani c2c7ce3
Add periodic clear to buffer pool watermark
wendani d87ea97
Add lua script for watermark_bufferpool
wendani 8ff93c8
Fix syntax error in buffer pool watermark lua script
wendani 84da7c9
Fix compile error in watermarkorch.cpp
wendani 73814cb
Fix from dut verification
wendani c727057
Add 6000 to read only polling mode
wendani 1ebeec1
Touch-up to existing codes
wendani 40ef377
Remove debugging symbols
wendani 24c56e2
Merge remote-tracking branch 'public/master' into buf_pool_wm_master
wendani 9ba2fa4
Address comments
wendani ba9b8e5
Merge remote-tracking branch 'public/master' into buf_pool_wm_master
wendani 3d66542
Address comments
wendani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| -- KEYS - buffer IDs | ||
| -- ARGV[1] - counters db index | ||
| -- ARGV[2] - counters table name | ||
| -- ARGV[3] - poll time interval | ||
| -- return nothing for now | ||
|
|
||
| local counters_db = ARGV[1] | ||
| local counters_table_name = 'COUNTERS' | ||
|
|
||
| local user_table_name = 'USER_WATERMARKS' | ||
| local persistent_table_name = 'PERSISTENT_WATERMARKS' | ||
| local periodic_table_name = 'PERIODIC_WATERMARKS' | ||
|
|
||
| local sai_buffer_pool_watermark_stat_name = 'SAI_BUFFER_POOL_STAT_WATERMARK_BYTES' | ||
|
|
||
| local rets = {} | ||
|
|
||
| redis.call('SELECT', counters_db) | ||
|
|
||
| -- Iterate through each buffer pool oid | ||
| local n = table.getn(KEYS) | ||
| for i = n, 1, -1 do | ||
| -- Get new watermark value from COUNTERS | ||
| local wm = redis.call('HGET', counters_table_name .. ':' .. KEYS[i], sai_buffer_pool_watermark_stat_name) | ||
| if wm then | ||
| wm = tonumber(wm) | ||
|
|
||
| -- Get last value from *_WATERMARKS | ||
| local user_wm_last = redis.call('HGET', user_table_name .. ':' .. KEYS[i], sai_buffer_pool_watermark_stat_name) | ||
|
|
||
| -- Set higher value to *_WATERMARKS | ||
| if user_wm_last then | ||
| user_wm_last = tonumber(user_wm_last) | ||
| if wm > user_wm_last then | ||
| redis.call('HSET', user_table_name .. ':' .. KEYS[i], sai_buffer_pool_watermark_stat_name, wm) | ||
| end | ||
| else | ||
| redis.call('HSET', user_table_name .. ':' .. KEYS[i], sai_buffer_pool_watermark_stat_name, wm) | ||
| end | ||
|
|
||
| local persistent_wm_last = redis.call('HGET', persistent_table_name .. ':' .. KEYS[i], sai_buffer_pool_watermark_stat_name) | ||
| if persistent_wm_last then | ||
| persistent_wm_last = tonumber(persistent_wm_last) | ||
| if wm > persistent_wm_last then | ||
| redis.call('HSET', persistent_table_name .. ':' .. KEYS[i], sai_buffer_pool_watermark_stat_name, wm) | ||
| end | ||
| else | ||
| redis.call('HSET', persistent_table_name .. ':' .. KEYS[i], sai_buffer_pool_watermark_stat_name, wm) | ||
| end | ||
|
|
||
| local periodic_wm_last = redis.call('HGET', periodic_table_name .. ':' .. KEYS[i], sai_buffer_pool_watermark_stat_name) | ||
| if periodic_wm_last then | ||
| periodic_wm_last = tonumber(periodic_wm_last) | ||
| if wm > periodic_wm_last then | ||
| redis.call('HSET', periodic_table_name .. ':' .. KEYS[i], sai_buffer_pool_watermark_stat_name, wm) | ||
| end | ||
| else | ||
| redis.call('HSET', periodic_table_name .. ':' .. KEYS[i], sai_buffer_pool_watermark_stat_name, wm) | ||
| end | ||
| end | ||
| end | ||
|
|
||
| return rets |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.