svn commit: r225424 - user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample

Adrian Chadd adrian at FreeBSD.org
Tue Sep 6 16:37:03 UTC 2011


Author: adrian
Date: Tue Sep  6 16:37:02 2011
New Revision: 225424
URL: http://svn.freebsd.org/changeset/base/225424

Log:
  Convert some packet fields to 64 bit values.
  
  Since I can now tx/rx ~ 18,000 pps, the 32 bit counters overflow
  the percentage calculations in a relatively easily obtained period
  of time (hours.) So given the likely uptime of some 802.11 links
  will be measured in days if not weeks, assume it'll overflow in
  the real world.

Modified:
  user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.c
  user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.h

Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.c	Tue Sep  6 15:12:51 2011	(r225423)
+++ user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.c	Tue Sep  6 16:37:02 2011	(r225424)
@@ -1208,15 +1208,15 @@ sample_stats(void *arg, struct ieee80211
 		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%%) (EWMA %3d.%1d%%) T %8d F %4d avg %5u last %u\n",
+			printf("[%2u %s:%4u] %8ju:%-8ju (%3d%%) (EWMA %3d.%1d%%) 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,
+			    (uintmax_t) sn->stats[y][rix].total_packets,
+			    (uintmax_t) sn->stats[y][rix].packets_acked,
+			    (int) ((100*sn->stats[y][rix].packets_acked)/sn->stats[y][rix].total_packets),
 			    sn->stats[y][rix].ewma_pct / 10,
 			    sn->stats[y][rix].ewma_pct % 10,
-			    sn->stats[y][rix].tries,
+			    (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);

Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.h
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.h	Tue Sep  6 15:12:51 2011	(r225423)
+++ user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.h	Tue Sep  6 16:37:02 2011	(r225424)
@@ -58,9 +58,9 @@ struct sample_softc {
 struct rate_stats {	
 	unsigned average_tx_time;
 	int successive_failures;
-	int tries;
-	int total_packets;	/* pkts total since assoc */
-	int packets_acked;	/* pkts acked since assoc */
+	uint64_t tries;
+	uint64_t total_packets;	/* pkts total since assoc */
+	uint64_t packets_acked;	/* pkts acked since assoc */
 	int ewma_pct;	/* EWMA percentage */
 	unsigned perfect_tx_time; /* transmit time for 0 retries */
 	int last_tx;


More information about the svn-src-user mailing list