00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef WIFI_FRAME_STATS_GAP_LENGTHS_HXX_
00023 # define WIFI_FRAME_STATS_GAP_LENGTHS_HXX_
00024
00025 # include <cassert>
00026
00027 # include <wipal/wifi/frame/stats/gap_lengths.hh>
00028
00029 namespace wifi
00030 {
00031
00032 namespace frame
00033 {
00034
00035 namespace stats
00036 {
00037
00038
00039 inline
00040 gap_lengths::gap_lengths(): gl_freqs_ (gl_freqs_size),
00041 gap_count_ (0)
00042 {
00043 }
00044
00045 inline
00046 void
00047 gap_lengths::account_gap(unsigned gap_length)
00048 {
00049 assert(0 < gap_length);
00050 assert(gap_length < gl_max);
00051
00052 ++gl_freqs_[gap_length / gl_freqs_resolution];
00053 ++gap_count_;
00054 }
00055
00056 inline
00057 std::ostream&
00058 gap_lengths::print(std::ostream& o) const
00059 {
00060 for (unsigned i = 0; i < gl_freqs_.size(); ++i)
00061 {
00062 const unsigned f = gl_freqs_[i];
00063
00064 if (not f)
00065 continue;
00066
00067 o << " " << (i * gl_freqs_resolution + (gl_freqs_resolution / 2))
00068 << '\t' << (double (f) / gap_count_) << '\n';
00069 }
00070 return o << std::flush;
00071 }
00072
00073
00074 }
00075
00076 }
00077
00078 }
00079
00080 #endif // ! WIFI_FRAME_STATS_GAP_LENGTHS_HXX_