2424#include " ioMonitor/include/IoAggregateMap.hh"
2525#include " mgm/fsview/FsView.hh"
2626
27- EOSMGMNAMESPACE_BEGIN
28-
27+ namespace eos ::mgm {
2928// --------------------------------------------
3029// / Main constructor
3130// --------------------------------------------
@@ -34,20 +33,18 @@ IoShaping::IoShaping(const size_t time)
3433 , _mPublishing(false )
3534 , _mShaping(false )
3635 , _receivingTime(time) {
37- // / The windows send to the FST's by default
38- _scaler. add_windows ( 10 );
39- _scaler.add_windows (60 );
40- _scaler. add_windows ( 300 );
36+ // Add default time windows to the scaler (in seconds)
37+ for ( const auto window : { 10 , 60 , 300 , 1200 }) {
38+ _scaler.add_windows (window );
39+ }
4140}
4241
4342// --------------------------------------------
4443// / Destructor
4544// --------------------------------------------
4645IoShaping::~IoShaping () {
4746 if (_mShaping.load ()) { _mShaping.store (false ); }
48-
4947 if (_mPublishing.load ()) { _mPublishing.store (false ); }
50-
5148 if (_mReceiving.load ()) { _mReceiving.store (false ); }
5249}
5350
@@ -107,17 +104,17 @@ IoBuffer::summarys IoShaping::aggregateSummarys(std::vector<IoBuffer::summarys>&
107104 for (auto window = aggregate->begin (); window != aggregate->end (); window++) {
108105 auto mutableApps = window->second .mutable_apps ();
109106 for (auto appMap = mutableApps->begin (); appMap != mutableApps->end (); appMap++) {
110- apps[window->first ][appMap->first ].push_back ( IoStatSummary ( appMap->second ) );
107+ apps[window->first ][appMap->first ].emplace_back ( appMap->second );
111108 }
112109
113110 auto mutableUids = window->second .mutable_uids ();
114111 for (auto uidMap = mutableUids->begin (); uidMap != mutableUids->end (); uidMap++) {
115- uids[window->first ][uidMap->first ].push_back ( IoStatSummary ( uidMap->second ) );
112+ uids[window->first ][uidMap->first ].emplace_back ( uidMap->second );
116113 }
117114
118115 auto mutableGids = window->second .mutable_gids ();
119116 for (auto gidMap = mutableGids->begin (); gidMap != mutableGids->end (); gidMap++) {
120- gids[window->first ][gidMap->first ].push_back ( IoStatSummary ( gidMap->second ) );
117+ gids[window->first ][gidMap->first ].emplace_back ( gidMap->second );
121118 }
122119 }
123120 }
@@ -589,5 +586,4 @@ bool IoShaping::rmGidsLimit() {
589586 _limiter.wGids .clear ();
590587 return true ;
591588}
592-
593- EOSMGMNAMESPACE_END
589+ } // namespace eos::mgm
0 commit comments