qcacmn: Fix average delay calculation for hist-stats
To calculate average delay for hist-stats, use the below formula : new-avg = (current-avg + new-delay) / 2. During accumulation of delay-stats for all the TID's for a peer, only the hist-buckets with non-zero counts should be considered for calculating the various delay levels. Change-Id: Ic930116bd650baab6a2b43e077cf55f5c79681d5 CRs-Fixed: 3178032
This commit is contained in:

committed by
Madan Koyyalamudi

parent
844445200d
commit
e7615d09c5
@@ -160,8 +160,7 @@ void dp_hist_update_stats(struct cdp_hist_stats *hist_stats, int value)
|
|||||||
if (qdf_unlikely(!hist_stats->avg))
|
if (qdf_unlikely(!hist_stats->avg))
|
||||||
hist_stats->avg = value;
|
hist_stats->avg = value;
|
||||||
else
|
else
|
||||||
hist_stats->avg = hist_stats->avg +
|
hist_stats->avg = (hist_stats->avg + value) / 2;
|
||||||
((value - hist_stats->avg) >> HIST_AVG_WEIGHT_DENOM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -194,14 +193,26 @@ void dp_copy_hist_stats(struct cdp_hist_stats *src_hist_stats,
|
|||||||
void dp_accumulate_hist_stats(struct cdp_hist_stats *src_hist_stats,
|
void dp_accumulate_hist_stats(struct cdp_hist_stats *src_hist_stats,
|
||||||
struct cdp_hist_stats *dst_hist_stats)
|
struct cdp_hist_stats *dst_hist_stats)
|
||||||
{
|
{
|
||||||
uint8_t index;
|
uint8_t index, hist_stats_valid = 0;
|
||||||
|
|
||||||
for (index = 0; index < CDP_HIST_BUCKET_MAX; index++)
|
for (index = 0; index < CDP_HIST_BUCKET_MAX; index++) {
|
||||||
dst_hist_stats->hist.freq[index] +=
|
dst_hist_stats->hist.freq[index] +=
|
||||||
src_hist_stats->hist.freq[index];
|
src_hist_stats->hist.freq[index];
|
||||||
dst_hist_stats->min = QDF_MIN(src_hist_stats->min, dst_hist_stats->min);
|
if (src_hist_stats->hist.freq[index])
|
||||||
dst_hist_stats->max = QDF_MAX(src_hist_stats->max, dst_hist_stats->max);
|
hist_stats_valid = 1;
|
||||||
dst_hist_stats->avg = (src_hist_stats->avg + dst_hist_stats->avg) >> 1;
|
}
|
||||||
|
/*
|
||||||
|
* If at least one hist-bucket has non-zero count,
|
||||||
|
* proceed with the detailed calculation.
|
||||||
|
*/
|
||||||
|
if (hist_stats_valid) {
|
||||||
|
dst_hist_stats->min = QDF_MIN(src_hist_stats->min,
|
||||||
|
dst_hist_stats->min);
|
||||||
|
dst_hist_stats->max = QDF_MAX(src_hist_stats->max,
|
||||||
|
dst_hist_stats->max);
|
||||||
|
dst_hist_stats->avg = (src_hist_stats->avg +
|
||||||
|
dst_hist_stats->avg) >> 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user