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

Get Bulk Stats API #1352

Merged
merged 9 commits into from
Jan 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions inc/saiobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,58 @@ sai_status_t sai_query_stats_capability(
_In_ sai_object_type_t object_type,
_Inout_ sai_stat_capability_list_t *stats_capability);

/**
* @brief Bulk objects get statistics.
*
* @param[in] switch_id SAI Switch object id
* @param[in] object_type Object type
* @param[in] object_count Number of objects to get the stats
* @param[in] object_key List of object keys
* @param[in] number_of_counters Number of counters in the array
* @param[in] counter_ids Specifies the array of counter ids
* @param[in] mode Statistics mode
* @param[inout] object_statuses Array of status for each object. Length of the array should be object_count. Should be looked only if API return is not SAI_STATUS_SUCCESS.
* @param[out] counters Array of resulting counter values.
* Length of counters array should be object_count*number_of_counters.
* Counter value of I object and J counter_id = counter[I*number_of_counters + J]
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
sai_status_t sai_bulk_object_get_stats(
_In_ sai_object_id_t switch_id,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses,
_Out_ uint64_t *counters);

/**
* @brief Bulk objects clear statistics.
*
* @param[in] switch_id SAI Switch object id
* @param[in] object_type Object type
* @param[in] object_count Number of objects to get the stats
* @param[in] object_key List of object keys
* @param[in] number_of_counters Number of counters in the array
* @param[in] counter_ids Specifies the array of counter ids
* @param[in] mode Statistics mode
* @param[inout] object_statuses Array of status for each object. Length of the array should be object_count. Should be looked only if API return is not SAI_STATUS_SUCCESS.
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
sai_status_t sai_bulk_object_clear_stats(
_In_ sai_object_id_t switch_id,
_In_ sai_object_type_t object_type,
_In_ uint32_t object_count,
_In_ const sai_object_key_t *object_key,
_In_ uint32_t number_of_counters,
_In_ const sai_stat_id_t *counter_ids,
_In_ sai_stats_mode_t mode,
_Inout_ sai_status_t *object_statuses);

/**
* @}
*/
Expand Down
15 changes: 15 additions & 0 deletions inc/saitypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,21 @@ typedef enum _sai_stats_mode_t
* @brief Read and clear after reading
*/
SAI_STATS_MODE_READ_AND_CLEAR = 1 << 1,

/**
* @brief Bulk read statistics
*/
SAI_STATS_MODE_BULK_READ = 1 << 2,

/**
* @brief Bulk clear statistics
*/
SAI_STATS_MODE_BULK_CLEAR = 1 << 3,

/**
* @brief Bulk read and clear after reading
*/
SAI_STATS_MODE_BULK_READ_AND_CLEAR = 1 << 4,
} sai_stats_mode_t;

typedef struct _sai_stat_capability_t
Expand Down
2 changes: 2 additions & 0 deletions meta/style.pm
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ sub CheckStatsFunction

return if $fname eq "sai_clear_port_all_stats_fn"; # exception
return if $fname eq "sai_get_tam_snapshot_stats_fn"; # exception
return if $fname eq "sai_bulk_object_get_stats_fn"; # exception
return if $fname eq "sai_bulk_object_clear_stats_fn"; # exception

if (not $fname =~ /^sai_((get|clear)_(\w+)_stats|get_\w+_stats_ext)_fn$/)
{
Expand Down