void Top::_appendToUsageMap( BSONObjBuilder& b , const UsageMap& map ) const { // pull all the names into a vector so we can sort them for the user vector<string> names; for ( UsageMap::const_iterator i = map.begin(); i != map.end(); ++i ) { names.push_back( i->first ); } std::sort( names.begin(), names.end() ); for ( size_t i=0; i<names.size(); i++ ) { BSONObjBuilder bb( b.subobjStart( names[i] ) ); const CollectionData& coll = map.find(names[i])->second; _appendStatsEntry( b , "total" , coll.total ); _appendStatsEntry( b , "readLock" , coll.readLock ); _appendStatsEntry( b , "writeLock" , coll.writeLock ); _appendStatsEntry( b , "queries" , coll.queries ); _appendStatsEntry( b , "getmore" , coll.getmore ); _appendStatsEntry( b , "insert" , coll.insert ); _appendStatsEntry( b , "update" , coll.update ); _appendStatsEntry( b , "remove" , coll.remove ); _appendStatsEntry( b , "commands" , coll.commands ); bb.done(); } }
void Top::_appendToUsageMap( BSONObjBuilder& b , const UsageMap& map ) const { for ( UsageMap::const_iterator i=map.begin(); i!=map.end(); i++ ){ BSONObjBuilder bb( b.subobjStart( i->first ) ); const CollectionData& coll = i->second; _appendStatsEntry( b , "total" , coll.total ); _appendStatsEntry( b , "readLock" , coll.readLock ); _appendStatsEntry( b , "writeLock" , coll.writeLock ); _appendStatsEntry( b , "queries" , coll.queries ); _appendStatsEntry( b , "getmore" , coll.getmore ); _appendStatsEntry( b , "insert" , coll.insert ); _appendStatsEntry( b , "update" , coll.update ); _appendStatsEntry( b , "remove" , coll.remove ); _appendStatsEntry( b , "commands" , coll.commands ); bb.done(); } }