summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2009-04-06 15:39:52 -0400
committerAaron <aaron@10gen.com>2009-04-06 15:39:52 -0400
commit53e63fd6461d652a1eec98371950aeaa757d86c5 (patch)
treeb69cf4e76939680109eab97ab3881ce6f3e81d20
parent57288fe0b21ec4c788627417181ebdeadaca0065 (diff)
downloadmongo-53e63fd6461d652a1eec98371950aeaa757d86c5.tar.gz
count perf tests
-rw-r--r--dbtests/perf/perftest.cpp44
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 >();
}
};