0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

some new perftests

This commit is contained in:
dwight 2011-07-11 08:07:59 -04:00
parent 1cf548fce0
commit ba44bb0a7c

View File

@ -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 >();