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