qcacmn: Add support to calculate percentile delay-stats

Add support to calculate percentile of delay-bound
for for Tx-delay stats.

Change-Id: If386e0d1c5091f260aa4281adbd3debde4bf8446
CRs-Fixed: 3243170
This commit is contained in:
Debasis Das
2022-07-12 13:31:49 +05:30
committed by Madan Koyyalamudi
parent 4fc084d9c6
commit 73c7a4f2a3
3 changed files with 45 additions and 1 deletions

View File

@@ -64,12 +64,14 @@ enum cdp_hist_bucket_index {
* @CDP_HIST_TYPE_REAP_STACK: Rx HW reap to stack deliver delay
* @CDP_HIST_TYPE_HW_TX_COMP_DELAY: Tx completion delay based on the timestamp
* provided by HW
* @CDP_HIST_TYPE_DELAY_PERCENTILE: Tx completion delay based on the perctile
*/
enum cdp_hist_types {
CDP_HIST_TYPE_SW_ENQEUE_DELAY,
CDP_HIST_TYPE_HW_COMP_DELAY,
CDP_HIST_TYPE_REAP_STACK,
CDP_HIST_TYPE_HW_TX_COMP_DELAY,
CDP_HIST_TYPE_DELAY_PERCENTILE,
CDP_HIST_TYPE_MAX,
};

View File

@@ -80,7 +80,7 @@ static uint16_t dp_hist_reap2stack_bucket[CDP_HIST_BUCKET_MAX] = {
0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60};
/*
* dp_hist_hw_tx_comp_dbucket: Tx HW Completion Delay bucket in us
* dp_hist_hw_tx_comp_dbucket: tx hw completion delay bucket in us
* @index_0 = 0_250 us
* @index_1 = 250_500 us
* @index_2 = 500_750 us
@@ -114,6 +114,43 @@ const char *dp_hist_tx_hw_delay_str(uint8_t index)
return dp_hist_hw_tx_comp_dbucket_str[index];
}
/*
* dp_hist_delay_percentile_dbucket: tx hw completion delay bucket in delay
* bound percentile
* @index_0 = 0_10
* @index_1 = 10_20
* @index_2 = 20_30
* @index_3 = 30_40
* @index_4 = 40_50
* @index_5 = 50_60
* @index_6 = 60_70
* @index_7 = 70_80
* @index_8 = 80_100
* @index_9 = 90_100
* @index_10 = 100_150
* @index_11 = 150_200
* @index_12 = 200+
*/
static uint16_t dp_hist_delay_percentile_dbucket[CDP_HIST_BUCKET_MAX] = {
0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200};
static
const char *dp_hist_delay_percentile_dbucket_str[CDP_HIST_BUCKET_MAX + 1] = {
"0 to 10%", "10 to 20%",
"20 to 30%", "30 to 40%",
"40 to 50%", "50 to 60%",
"60 to 70%", "70 to 80%",
"80 to 90% ", "90 to 100%",
"100 to 150% ", "150 to 200%", "200+%"
};
const char *dp_hist_delay_percentile_str(uint8_t index)
{
if (index > CDP_HIST_BUCKET_MAX)
return "Invalid index";
return dp_hist_delay_percentile_dbucket_str[index];
}
/*
* dp_hist_find_bucket_idx: Find the bucket index
* @bucket_array: Bucket array
@@ -168,6 +205,10 @@ static void dp_hist_fill_buckets(struct cdp_hist_bucket *hist_bucket, int value)
idx = dp_hist_find_bucket_idx(
&dp_hist_hw_tx_comp_dbucket[0], value);
break;
case CDP_HIST_TYPE_DELAY_PERCENTILE:
idx = dp_hist_find_bucket_idx(
&dp_hist_delay_percentile_dbucket[0], value);
break;
default:
break;
}

View File

@@ -42,4 +42,5 @@ void dp_accumulate_hist_stats(struct cdp_hist_stats *src_hist_stats,
void dp_copy_hist_stats(struct cdp_hist_stats *src_hist_stats,
struct cdp_hist_stats *dst_hist_stats);
const char *dp_hist_tx_hw_delay_str(uint8_t index);
const char *dp_hist_delay_percentile_str(uint8_t index);
#endif /* __DP_HIST_H_ */