Some cosmetic fixes to ath_rate_sample.

* Use 64 bit integer types for the sample rate statistics.
  When TX'ing 11n aggregates, a 32 bit counter will overflow in a few
  hours due to the high packet throughput.

* Create a default label of "" rather than defaulting to "Mb" - that way
  if a rate hasn't yet been selected, it won't say "-1 Mb".

Sponsored by:	Hobnob, Inc.
This commit is contained in:
adrian 2011-11-08 14:46:03 +00:00
parent a73ffc7e72
commit 8f9fd74063
2 changed files with 14 additions and 8 deletions

View File

@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
*/
#include "opt_inet.h"
#include "opt_wlan.h"
#include "opt_ah.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -146,6 +147,8 @@ ath_rate_node_cleanup(struct ath_softc *sc, struct ath_node *an)
static int
dot11rate(const HAL_RATE_TABLE *rt, int rix)
{
if (rix < 0)
return -1;
return rt->info[rix].phy == IEEE80211_T_HT ?
rt->info[rix].dot11Rate : (rt->info[rix].dot11Rate & IEEE80211_RATE_VAL) / 2;
}
@ -153,6 +156,8 @@ dot11rate(const HAL_RATE_TABLE *rt, int rix)
static const char *
dot11rate_label(const HAL_RATE_TABLE *rt, int rix)
{
if (rix < 0)
return "";
return rt->info[rix].phy == IEEE80211_T_HT ? "MCS" : "Mb ";
}
@ -903,13 +908,14 @@ sample_stats(void *arg, struct ieee80211_node *ni)
for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) {
if (sn->stats[y][rix].total_packets == 0)
continue;
printf("[%2u %s:%4u] %8d:%-8d (%3d%%) T %8d F %4d avg %5u last %u\n",
printf("[%2u %s:%4u] %8ju:%-8ju (%3d%%) T %8ju F %4d avg %5u last %u\n",
dot11rate(rt, rix), dot11rate_label(rt, rix),
bin_to_size(y),
sn->stats[y][rix].total_packets,
sn->stats[y][rix].packets_acked,
(100*sn->stats[y][rix].packets_acked)/sn->stats[y][rix].total_packets,
sn->stats[y][rix].tries,
(uintmax_t) sn->stats[y][rix].total_packets,
(uintmax_t) sn->stats[y][rix].packets_acked,
(int) ((sn->stats[y][rix].packets_acked * 100ULL) /
sn->stats[y][rix].total_packets),
(uintmax_t) sn->stats[y][rix].tries,
sn->stats[y][rix].successive_failures,
sn->stats[y][rix].average_tx_time,
ticks - sn->stats[y][rix].last_tx);

View File

@ -57,9 +57,9 @@ struct sample_softc {
struct rate_stats {
unsigned average_tx_time;
int successive_failures;
int tries;
int total_packets;
int packets_acked;
uint64_t tries;
uint64_t total_packets; /* pkts total since assoc */
uint64_t packets_acked; /* pkts acked since assoc */
unsigned perfect_tx_time; /* transmit time for 0 retries */
int last_tx;
};