diff options
author | Aaron <aaron@10gen.com> | 2009-04-06 15:39:52 -0400 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2009-04-06 15:39:52 -0400 |
commit | 53e63fd6461d652a1eec98371950aeaa757d86c5 (patch) | |
tree | b69cf4e76939680109eab97ab3881ce6f3e81d20 | |
parent | 57288fe0b21ec4c788627417181ebdeadaca0065 (diff) | |
download | mongo-53e63fd6461d652a1eec98371950aeaa757d86c5.tar.gz |
count perf tests
-rw-r--r-- | dbtests/perf/perftest.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/dbtests/perf/perftest.cpp b/dbtests/perf/perftest.cpp index 15f4fc90e92..fc1cd7a4392 100644 --- a/dbtests/perf/perftest.cpp +++ b/dbtests/perf/perftest.cpp @@ -533,6 +533,47 @@ namespace QueryTests { auto_ptr< DBClientCursor > c_; }; + class Count { + public: + Count() : ns_( testNs( this ) ) { + BSONObj obj = BSON( "a" << 1 ); + for( int i = 0; i < 100000; ++i ) + client_->insert( ns_.c_str(), obj ); + } + void run() { + ASSERT_EQUALS( 100000, client_->count( ns_, BSON( "a" << 1 ) ) ); + } + string ns_; + }; + + class CountIndex { + public: + CountIndex() : ns_( testNs( this ) ) { + BSONObj obj = BSON( "a" << 1 ); + for( int i = 0; i < 100000; ++i ) + client_->insert( ns_.c_str(), obj ); + client_->ensureIndex( ns_, obj ); + } + void run() { + ASSERT_EQUALS( 100000, client_->count( ns_, BSON( "a" << GTE << 1 ) ) ); + } + string ns_; + }; + + class CountSimpleIndex { + public: + CountSimpleIndex() : ns_( testNs( this ) ) { + BSONObj obj = BSON( "a" << 1 ); + for( int i = 0; i < 100000; ++i ) + client_->insert( ns_.c_str(), obj ); + client_->ensureIndex( ns_, obj ); + } + void run() { + ASSERT_EQUALS( 100000, client_->count( ns_, BSON( "a" << 1 ) ) ); + } + string ns_; + }; + class All : public RunnerSuite { public: All() { @@ -544,6 +585,9 @@ namespace QueryTests { add< GetMore >(); add< GetMoreIndex >(); add< GetMoreKeyMatchHelps >(); + add< Count >(); + add< CountIndex >(); + add< CountSimpleIndex >(); } }; |