summaryrefslogtreecommitdiff
path: root/dbtests
diff options
context:
space:
mode:
authordwight <dwight@10gen.com>2011-07-11 08:07:59 -0400
committerdwight <dwight@10gen.com>2011-07-11 08:07:59 -0400
commitba44bb0a7c6b7ed0f242ff15a2c5dd82c4b07b7c (patch)
tree800a468dc3538a576ea174db43c410405b5ed431 /dbtests
parent1cf548fce008223adc4126c3b52195203d425ca8 (diff)
downloadmongo-ba44bb0a7c6b7ed0f242ff15a2c5dd82c4b07b7c.tar.gz
some new perftests
Diffstat (limited to 'dbtests')
-rw-r--r--dbtests/perftests.cpp59
1 files changed, 58 insertions, 1 deletions
diff --git a/dbtests/perftests.cpp b/dbtests/perftests.cpp
index 37e2bdc97c7..eb9c454c6dc 100644
--- a/dbtests/perftests.cpp
+++ b/dbtests/perftests.cpp
@@ -418,13 +418,65 @@ namespace PerfTests {
string name() { return "Timer"; }
virtual int howLongMillis() { return 1000; }
virtual bool showDurStats() { return false; }
-
void timed() {
mongo::Timer t;
aaa += t.millis();
}
};
+ RWLock lk("testrw");
+ SimpleMutex m("simptst");
+ mongo::mutex mtest("mtest");
+
+ class mutexspeed : public B {
+ public:
+ string name() { return "mutex"; }
+ virtual int howLongMillis() { return 500; }
+ virtual bool showDurStats() { return false; }
+ void timed() {
+ mongo::mutex::scoped_lock lk(mtest);
+ }
+ };
+ class simplemutexspeed : public B {
+ public:
+ string name() { return "simplemutex"; }
+ virtual int howLongMillis() { return 500; }
+ virtual bool showDurStats() { return false; }
+ void timed() {
+ SimpleMutex::scoped_lock lk(m);
+ }
+ };
+ class rlock : public B {
+ public:
+ string name() { return "rlock"; }
+ virtual int howLongMillis() { return 500; }
+ virtual bool showDurStats() { return false; }
+ void timed() {
+ lk.lock_shared();
+ lk.unlock_shared();
+ }
+ };
+ class wlock : public B {
+ public:
+ string name() { return "wlock"; }
+ virtual int howLongMillis() { return 500; }
+ virtual bool showDurStats() { return false; }
+ void timed() {
+ lk.lock();
+ lk.unlock();
+ }
+ };
+ class ulock : public B {
+ public:
+ string name() { return "ulock"; }
+ virtual int howLongMillis() { return 500; }
+ virtual bool showDurStats() { return false; }
+ void timed() {
+ lk.lockAsUpgradable();
+ lk.unlockFromUpgradable();
+ }
+ };
+
class CTM : public B {
public:
CTM() : last(0), delts(0), n(0) { }
@@ -753,6 +805,11 @@ namespace PerfTests {
add< TLS >();
add< Malloc >();
add< Timer >();
+ add< rlock >();
+ add< wlock >();
+ add< ulock >();
+ add< mutexspeed >();
+ add< simplemutexspeed >();
add< CTM >();
add< KeyTest >();
add< Bldr >();