Exemplo n.º 1
0
MojErr MojDbPerfCreateTest::batchPutLargeObj(MojDb& db, const MojChar* kindId, MojUInt64& largeObjTime)
{
	timespec startTime;
	startTime.tv_nsec = 0;
	startTime.tv_sec = 0;
	timespec endTime;
	endTime.tv_nsec = 0;
	endTime.tv_sec = 0;

	MojObject objArray;

	for (MojUInt64 i = 0; i < numInsert; i++) {
		MojObject obj;
		MojErr err = obj.putString(MojDb::KindKey, kindId);
		MojTestErrCheck(err);
		err = createLargeObj(obj, i);
		MojTestErrCheck(err);
		err = objArray.push(obj);
		MojTestErrCheck(err);
	}

	MojObject::ArrayIterator begin;
	MojErr err = objArray.arrayBegin(begin);
	MojTestErrCheck(err);
	MojObject::ConstArrayIterator end = objArray.arrayEnd();
	clock_gettime(CLOCK_REALTIME, &startTime);
	err = db.put(begin, end);
	MojTestErrCheck(err);
	clock_gettime(CLOCK_REALTIME, &endTime);
	largeObjTime += timeDiff(startTime, endTime);
	totalTestTime += timeDiff(startTime, endTime);

	return MojErrNone;
}
Exemplo n.º 2
0
MojErr MojDbPerfCreateTest::batchPutLargeObj(MojDb& db, const MojChar* kindId, MojTime& largeObjTime)
{
	MojTime startTime;
	MojTime endTime;

	MojObject objArray;

	for (MojUInt64 i = 0; i < numInsert; i++) {
		MojObject obj;
		MojErr err = obj.putString(MojDb::KindKey, kindId);
		MojTestErrCheck(err);
		err = createLargeObj(obj, i);
		MojTestErrCheck(err);
		err = objArray.push(obj);
		MojTestErrCheck(err);
	}

	MojObject::ArrayIterator begin;
	MojErr err = objArray.arrayBegin(begin);
	MojTestErrCheck(err);
	MojObject::ConstArrayIterator end = objArray.arrayEnd();
	err = MojGetCurrentTime(startTime);
	MojTestErrCheck(err);
	err = db.put(begin, end);
	MojTestErrCheck(err);
	err = MojGetCurrentTime(endTime);
	MojTestErrCheck(err);
	largeObjTime += (endTime - startTime);
	totalTestTime += (endTime - startTime);

	return MojErrNone;
}
Exemplo n.º 3
0
MojErr MojDbPerfCreateTest::putLargeObj(MojDb& db, const MojChar* kindId, MojUInt64& largeObjTime)
{
	timespec startTime;
	startTime.tv_nsec = 0;
	startTime.tv_sec = 0;
	timespec endTime;
	endTime.tv_nsec = 0;
	endTime.tv_sec = 0;

	for (MojUInt64 i = 0; i < numInsert; i++) {
		MojObject obj;
		MojErr err = obj.putString(MojDb::KindKey, kindId);
		MojTestErrCheck(err);
		err = createLargeObj(obj, i);
		MojTestErrCheck(err);

		clock_gettime(CLOCK_REALTIME, &startTime);
		err = db.put(obj);
		MojTestErrCheck(err);
		clock_gettime(CLOCK_REALTIME, &endTime);
		largeObjTime += timeDiff(startTime, endTime);
		totalTestTime += timeDiff(startTime, endTime);
	}

	return MojErrNone;
}
Exemplo n.º 4
0
MojErr MojDbPerfCreateTest::putLargeObj(MojDb& db, const MojChar* kindId, MojTime& largeObjTime)
{
	MojTime startTime;
	MojTime endTime;

	for (MojUInt64 i = 0; i < numInsert; i++) {
		MojObject obj;
		MojErr err = obj.putString(MojDb::KindKey, kindId);
		MojTestErrCheck(err);
		err = createLargeObj(obj, i);
		MojTestErrCheck(err);

		err = MojGetCurrentTime(startTime);
		MojTestErrCheck(err);
		err = db.put(obj);
		MojTestErrCheck(err);
		err = MojGetCurrentTime(endTime);
		MojTestErrCheck(err);
		largeObjTime += (endTime - startTime);
		totalTestTime += (endTime - startTime);
	}

	return MojErrNone;
}