diff --git a/src/wifi/model/minstrel-ht-wifi-manager.cc b/src/wifi/model/minstrel-ht-wifi-manager.cc index b9c2c7564..674851ab0 100644 --- a/src/wifi/model/minstrel-ht-wifi-manager.cc +++ b/src/wifi/model/minstrel-ht-wifi-manager.cc @@ -444,9 +444,6 @@ MinstrelHtWifiManager::CheckInit (MinstrelHtWifiRemoteStation *station) station->m_sampleTable = SampleRate (m_numRates, std::vector (m_nSampleCol)); InitSampleTable (station); RateInit (station); - std::ostringstream tmp; - tmp << "minstrel-ht-stats-" << station->m_state->m_address << ".txt"; - station->m_statsFile.open (tmp.str ().c_str (), std::ios::out); station->m_initialized = true; } } @@ -1611,6 +1608,13 @@ MinstrelHtWifiManager::InitSampleTable (MinstrelHtWifiRemoteStation *station) void MinstrelHtWifiManager::PrintTable (MinstrelHtWifiRemoteStation *station) { + if (!station->m_statsFile.is_open ()) + { + std::ostringstream tmp; + tmp << "minstrel-ht-stats-" << station->m_state->m_address << ".txt"; + station->m_statsFile.open (tmp.str ().c_str (), std::ios::out); + } + station->m_statsFile << " best ____________rate__________ ________statistics________ ________last_______ ______sum-of________\n" << " mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [prob.|retry|suc|att] [#success | #attempts]\n"; for (uint8_t i = 0; i < m_numGroups; i++) diff --git a/src/wifi/model/minstrel-wifi-manager.cc b/src/wifi/model/minstrel-wifi-manager.cc index dda317aa2..099b48bb7 100644 --- a/src/wifi/model/minstrel-wifi-manager.cc +++ b/src/wifi/model/minstrel-wifi-manager.cc @@ -216,9 +216,6 @@ MinstrelWifiManager::CheckInit (MinstrelWifiRemoteStation *station) InitSampleTable (station); RateInit (station); station->m_initialized = true; - std::ostringstream tmp; - tmp << "minstrel-stats-" << station->m_state->m_address << ".txt"; - station->m_statsFile.open (tmp.str ().c_str (), std::ios::out); } } @@ -1043,6 +1040,13 @@ MinstrelWifiManager::PrintSampleTable (MinstrelWifiRemoteStation *station) void MinstrelWifiManager::PrintTable (MinstrelWifiRemoteStation *station) { + if (!station->m_statsFile.is_open ()) + { + std::ostringstream tmp; + tmp << "minstrel-stats-" << station->m_state->m_address << ".txt"; + station->m_statsFile.open (tmp.str ().c_str (), std::ios::out); + } + station->m_statsFile << "best _______________rate________________ ________statistics________ ________last_______ ______sum-of________\n" << "rate [ name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [prob.|retry|suc|att] [#success | #attempts]\n";