summaryrefslogtreecommitdiff
path: root/src/mongo/db/stats
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2012-12-10 15:17:32 -0500
committerEliot Horowitz <eliot@10gen.com>2012-12-10 15:17:32 -0500
commit4a5a2afbe2ca352dd518d733274538a27760ac0b (patch)
treeeb9527d53beff3582e5a426b3370c8cd792a02fa /src/mongo/db/stats
parent96d64fa57c8c464d6a724dfdf99453758406447e (diff)
downloadmongo-4a5a2afbe2ca352dd518d733274538a27760ac0b.tar.gz
SERVER-7886 use UnorderedFastKeyTable in Top
Diffstat (limited to 'src/mongo/db/stats')
-rw-r--r--src/mongo/db/stats/snapshots.cpp4
-rw-r--r--src/mongo/db/stats/top.cpp8
-rw-r--r--src/mongo/db/stats/top.h4
3 files changed, 8 insertions, 8 deletions
diff --git a/src/mongo/db/stats/snapshots.cpp b/src/mongo/db/stats/snapshots.cpp
index 272887cf252..35f0768d79f 100644
--- a/src/mongo/db/stats/snapshots.cpp
+++ b/src/mongo/db/stats/snapshots.cpp
@@ -48,7 +48,7 @@ namespace mongo {
verify( _newer._created > _older._created );
Top::UsageMap u;
- for ( Top::UsageMap::const_iterator i=_newer._usage.begin(); i != _newer._usage.end(); i++ ) {
+ for ( Top::UsageMap::const_iterator i=_newer._usage.begin(); i != _newer._usage.end(); ++i ) {
Top::UsageMap::const_iterator j = _older._usage.find(i->first);
if (j != _older._usage.end())
u[i->first] = Top::CollectionData( j->second , i->second );
@@ -210,7 +210,7 @@ namespace mongo {
display( ss , (double) delta->elapsed() , "TOTAL" , delta->globalUsageDiff() );
Top::UsageMap usage = delta->collectionUsageDiff();
- for ( Top::UsageMap::iterator i=usage.begin(); i != usage.end(); i++ ) {
+ for ( Top::UsageMap::const_iterator i=usage.begin(); i != usage.end(); ++i ) {
display( ss , (double) delta->elapsed() , i->first , i->second );
}
diff --git a/src/mongo/db/stats/top.cpp b/src/mongo/db/stats/top.cpp
index 4ade7325c31..74969222f7b 100644
--- a/src/mongo/db/stats/top.cpp
+++ b/src/mongo/db/stats/top.cpp
@@ -43,18 +43,18 @@ namespace mongo {
}
void Top::record( const StringData& ns , int op , int lockType , long long micros , bool command ) {
- if ( ns.data()[0] == '?' )
+ if ( ns[0] == '?' )
return;
//cout << "record: " << ns << "\t" << op << "\t" << command << endl;
SimpleMutex::scoped_lock lk(_lock);
- if ( ( command || op == dbQuery ) && str::equals( ns.data(), _lastDropped.c_str() ) ) {
+ if ( ( command || op == dbQuery ) && ns == _lastDropped ) {
_lastDropped = "";
return;
}
- CollectionData& coll = _usage[ns.data()];
+ CollectionData& coll = _usage[ns];
_record( coll , op , lockType , micros , command );
_record( _global , op , lockType , micros , command );
}
@@ -122,7 +122,7 @@ namespace mongo {
// 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++ ) {
+ for ( UsageMap::const_iterator i = map.begin(); i != map.end(); ++i ) {
names.push_back( i->first );
}
diff --git a/src/mongo/db/stats/top.h b/src/mongo/db/stats/top.h
index 4742f5eb96c..2a326f38806 100644
--- a/src/mongo/db/stats/top.h
+++ b/src/mongo/db/stats/top.h
@@ -19,7 +19,7 @@
#include <boost/date_time/posix_time/posix_time.hpp>
-#include "mongo/platform/unordered_map.h"
+#include "mongo/util/string_map.h"
namespace mongo {
@@ -63,7 +63,7 @@ namespace mongo {
UsageData commands;
};
- typedef unordered_map<string,CollectionData> UsageMap;
+ typedef StringMap<CollectionData> UsageMap;
public:
void record( const StringData& ns , int op , int lockType , long long micros , bool command );