xref: /haiku/src/tests/kits/app/bmessage/MessageSpeedTest.cpp (revision bef39d09af0c445880b7dd9cc039d39a89d66365)
197d2f9c0SMichael Lotz /*
297d2f9c0SMichael Lotz  * Copyright 2005, Haiku.
397d2f9c0SMichael Lotz  * Distributed under the terms of the MIT License.
497d2f9c0SMichael Lotz  *
597d2f9c0SMichael Lotz  * Authors:
697d2f9c0SMichael Lotz  *		Michael Lotz <mmlr@mlotz.ch>
797d2f9c0SMichael Lotz  *		Olivier Milla <methedras at online dot fr>
897d2f9c0SMichael Lotz  */
9f75b92e7SJérôme Duval 
10f75b92e7SJérôme Duval #include <iostream>
11*bef39d09SClemens Zeidler #include <stdio.h>
12*bef39d09SClemens Zeidler #include <stdlib.h>
13f75b92e7SJérôme Duval #include <time.h>
14f75b92e7SJérôme Duval 
15f75b92e7SJérôme Duval #include <Entry.h>
16f75b92e7SJérôme Duval #include <File.h>
17f75b92e7SJérôme Duval #include <Message.h>
18f75b92e7SJérôme Duval #include <String.h>
19f75b92e7SJérôme Duval 
20f75b92e7SJérôme Duval #include "MessageSpeedTest.h"
21f75b92e7SJérôme Duval 
22*bef39d09SClemens Zeidler 
23*bef39d09SClemens Zeidler using namespace std;
24*bef39d09SClemens Zeidler 
25*bef39d09SClemens Zeidler 
26896d7771SMichael Lotz #define LOG_TO_FILE
2797d2f9c0SMichael Lotz #ifdef LOG_TO_FILE
2897d2f9c0SMichael Lotz #define LOG(function, time)													\
2997d2f9c0SMichael Lotz 	{																		\
3097d2f9c0SMichael Lotz 		FILE *logfile = fopen("/boot/home/Desktop/messagespeed.log", "a");	\
3197d2f9c0SMichael Lotz 		fprintf(logfile, "%s:\t%lld\n", function, time);					\
3297d2f9c0SMichael Lotz 		fclose(logfile);													\
33f75b92e7SJérôme Duval 	}
3497d2f9c0SMichael Lotz #else
3597d2f9c0SMichael Lotz #define LOG(function, time) /* empty */
3697d2f9c0SMichael Lotz #endif
37f75b92e7SJérôme Duval 
38f75b92e7SJérôme Duval 
3997d2f9c0SMichael Lotz #define MESSAGE_SPEED_TEST_CREATE(count, type, typeName, createValue)		\
4097d2f9c0SMichael Lotz void																		\
4197d2f9c0SMichael Lotz TMessageSpeedTest::MessageSpeedTestCreate##count##type()					\
4297d2f9c0SMichael Lotz {																			\
4397d2f9c0SMichael Lotz 	BMessage message;														\
4497d2f9c0SMichael Lotz 	bigtime_t length = 0;													\
4597d2f9c0SMichael Lotz 																			\
4697d2f9c0SMichael Lotz 	for (int32 i = 0; i < count; i++) {										\
4797d2f9c0SMichael Lotz 		createValue;														\
4897d2f9c0SMichael Lotz 		bigtime_t stamp = real_time_clock_usecs();							\
4997d2f9c0SMichael Lotz 		message.Add##type("data", value);									\
5097d2f9c0SMichael Lotz 		length += (real_time_clock_usecs() - stamp);						\
5197d2f9c0SMichael Lotz 	}																		\
5297d2f9c0SMichael Lotz 																			\
5397d2f9c0SMichael Lotz 	cout << "Time to add " << count << " " << typeName						\
5497d2f9c0SMichael Lotz 		<< " in a message = " << length << "usec" << endl;					\
5597d2f9c0SMichael Lotz 	LOG(__PRETTY_FUNCTION__, length);										\
56f75b92e7SJérôme Duval }
57f75b92e7SJérôme Duval 
5897d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_CREATE(5, Int32, "int32", int32 value = i);
5997d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_CREATE(50, Int32, "int32", int32 value = i);
6097d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_CREATE(500, Int32, "int32", int32 value = i);
6197d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_CREATE(5000, Int32, "int32", int32 value = i);
62f75b92e7SJérôme Duval 
6397d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_CREATE(5, String, "BString", BString value = "item"; value << i);
6497d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_CREATE(50, String, "BString", BString value = "item"; value << i);
6597d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_CREATE(500, String, "BString", BString value = "item"; value << i);
6697d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_CREATE(5000, String, "BString", BString value = "item"; value << i);
67f75b92e7SJérôme Duval 
6897d2f9c0SMichael Lotz #undef MESSAGE_SPEED_TEST_CREATE
69f75b92e7SJérôme Duval 
70f75b92e7SJérôme Duval 
7197d2f9c0SMichael Lotz #define MESSAGE_SPEED_TEST_LOOKUP(count, type)								\
7297d2f9c0SMichael Lotz void																		\
7397d2f9c0SMichael Lotz TMessageSpeedTest::MessageSpeedTestLookup##count##type()					\
7497d2f9c0SMichael Lotz {																			\
7597d2f9c0SMichael Lotz 	srand(time(NULL));														\
7697d2f9c0SMichael Lotz 	BMessage message;														\
7797d2f9c0SMichael Lotz 																			\
78629192bcSMichael Lotz 	for (int32 i = 0; i < count; i++) {										\
7997d2f9c0SMichael Lotz 		BString string;														\
8097d2f9c0SMichael Lotz 		string << i;														\
8197d2f9c0SMichael Lotz 		message.AddInt32(string.String(), i);								\
8297d2f9c0SMichael Lotz 	}																		\
8397d2f9c0SMichael Lotz 																			\
8497d2f9c0SMichael Lotz 	BString search;															\
8597d2f9c0SMichael Lotz 	search << rand() % count;												\
8697d2f9c0SMichael Lotz 	const char *string = search.String();									\
8797d2f9c0SMichael Lotz 	int32 res;																\
8897d2f9c0SMichael Lotz 																			\
8997d2f9c0SMichael Lotz 	bigtime_t stamp = real_time_clock_usecs();								\
9097d2f9c0SMichael Lotz 	message.FindInt32(string, &res);										\
9197d2f9c0SMichael Lotz 	bigtime_t length = real_time_clock_usecs() - stamp;						\
9297d2f9c0SMichael Lotz 	cout << "Time to find a data in a message containing " << count			\
9397d2f9c0SMichael Lotz 		<< " items = " << length << "usec" << endl;							\
9497d2f9c0SMichael Lotz 	LOG(__PRETTY_FUNCTION__, length);										\
95024ef0b8SMichael Lotz }
96024ef0b8SMichael Lotz 
9797d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_LOOKUP(5, Int32);
9897d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_LOOKUP(50, Int32);
9997d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_LOOKUP(500, Int32);
10097d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_LOOKUP(5000, Int32);
101024ef0b8SMichael Lotz 
10297d2f9c0SMichael Lotz #undef MESSAGE_SPEED_TEST_LOOKUP
103024ef0b8SMichael Lotz 
10497d2f9c0SMichael Lotz 
10597d2f9c0SMichael Lotz #define MESSAGE_SPEED_TEST_READ(count, type, typeName, createValue, declareValue)	\
10697d2f9c0SMichael Lotz void																		\
10797d2f9c0SMichael Lotz TMessageSpeedTest::MessageSpeedTestRead##count##type()						\
10897d2f9c0SMichael Lotz {																			\
10997d2f9c0SMichael Lotz 	srand(time(NULL));														\
11097d2f9c0SMichael Lotz 	BMessage message;														\
11197d2f9c0SMichael Lotz 																			\
11297d2f9c0SMichael Lotz 	for (int32 i = 0; i < count; i++) {										\
11397d2f9c0SMichael Lotz 		createValue;														\
11497d2f9c0SMichael Lotz 		message.Add##type("data", value);									\
11597d2f9c0SMichael Lotz 	}																		\
11697d2f9c0SMichael Lotz 																			\
11797d2f9c0SMichael Lotz 	declareValue;															\
11897d2f9c0SMichael Lotz 	bigtime_t length = 0;													\
11997d2f9c0SMichael Lotz 	for (int32 i = 0; i < count; i++) {										\
12097d2f9c0SMichael Lotz 		bigtime_t stamp = real_time_clock_usecs();							\
12197d2f9c0SMichael Lotz 		message.Find##type("data", i, &value);								\
12297d2f9c0SMichael Lotz 		length += (real_time_clock_usecs() - stamp);						\
12397d2f9c0SMichael Lotz 	}																		\
12497d2f9c0SMichael Lotz 																			\
12597d2f9c0SMichael Lotz 	cout << "Time to retrieve " << count << " " << typeName					\
12697d2f9c0SMichael Lotz 		<< " out of a message = " << length << "usec. Giving "				\
12797d2f9c0SMichael Lotz 		<< length / count << "usec per retrieve." << endl;					\
12897d2f9c0SMichael Lotz 	LOG(__PRETTY_FUNCTION__, length);										\
129024ef0b8SMichael Lotz }
130024ef0b8SMichael Lotz 
13197d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_READ(5, Int32, "int32", int32 value = i, int32 value);
13297d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_READ(50, Int32, "int32", int32 value = i, int32 value);
13397d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_READ(500, Int32, "int32", int32 value = i, int32 value);
13497d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_READ(5000, Int32, "int32", int32 value = i, int32 value);
135024ef0b8SMichael Lotz 
13697d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_READ(5, String, "BString", BString value = "item"; value << i, BString value);
13797d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_READ(50, String, "BString", BString value = "item"; value << i, BString value);
13897d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_READ(500, String, "BString", BString value = "item"; value << i, BString value);
13997d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_READ(5000, String, "BString", BString value = "item"; value << i, BString value);
140024ef0b8SMichael Lotz 
14197d2f9c0SMichael Lotz #undef MESSAGE_SPEED_TEST_READ
14297d2f9c0SMichael Lotz 
14397d2f9c0SMichael Lotz 
14497d2f9c0SMichael Lotz #define MESSAGE_SPEED_TEST_FLATTEN(count, type, typeName, createValue)		\
14597d2f9c0SMichael Lotz void																		\
14697d2f9c0SMichael Lotz TMessageSpeedTest::MessageSpeedTestFlatten##count##type()					\
14797d2f9c0SMichael Lotz {																			\
14897d2f9c0SMichael Lotz 	BMessage message;														\
14997d2f9c0SMichael Lotz 																			\
15097d2f9c0SMichael Lotz 	for (int32 i = 0; i < count; i++) { 									\
15197d2f9c0SMichael Lotz 		createValue;														\
15297d2f9c0SMichael Lotz 		message.Add##type("data", value);									\
15397d2f9c0SMichael Lotz 	}																		\
15497d2f9c0SMichael Lotz 																			\
155896d7771SMichael Lotz 	BMallocIO buffer;														\
156896d7771SMichael Lotz 	bigtime_t stamp = real_time_clock_usecs();								\
157896d7771SMichael Lotz 	message.Flatten(&buffer);												\
158896d7771SMichael Lotz 	bigtime_t length = real_time_clock_usecs() - stamp;						\
159896d7771SMichael Lotz 																			\
16097d2f9c0SMichael Lotz 	BString name = "/tmp/MessageSpeedTestFlatten";							\
16197d2f9c0SMichael Lotz 	name << count << typeName;												\
16297d2f9c0SMichael Lotz 	BEntry entry(name.String());											\
16397d2f9c0SMichael Lotz 	BFile file(&entry, B_READ_WRITE | B_CREATE_FILE);						\
164896d7771SMichael Lotz 	file.Write(buffer.Buffer(), buffer.BufferLength());						\
16597d2f9c0SMichael Lotz 																			\
16697d2f9c0SMichael Lotz 	cout << "Time to flatten a message containing " << count << " "			\
16797d2f9c0SMichael Lotz 		<< typeName << " = " << length << "usec. Giving " << length / count	\
16897d2f9c0SMichael Lotz 		<< "usec per item." << endl;										\
16997d2f9c0SMichael Lotz 	LOG(__PRETTY_FUNCTION__, length);										\
170024ef0b8SMichael Lotz }
171024ef0b8SMichael Lotz 
17297d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN(5, Int32, "int32", int32 value = i);
17397d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN(50, Int32, "int32", int32 value = i);
17497d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN(500, Int32, "int32", int32 value = i);
17597d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN(5000, Int32, "int32", int32 value = i);
176024ef0b8SMichael Lotz 
17797d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN(5, String, "BString", BString value = "item"; value << i);
17897d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN(50, String, "BString", BString value = "item"; value << i);
17997d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN(500, String, "BString", BString value = "item"; value << i);
18097d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN(5000, String, "BString", BString value = "item"; value << i);
181024ef0b8SMichael Lotz 
18297d2f9c0SMichael Lotz #undef MESSAGE_SPEED_TEST_FLATTEN
18397d2f9c0SMichael Lotz 
18497d2f9c0SMichael Lotz 
18597d2f9c0SMichael Lotz #define MESSAGE_SPEED_TEST_FLATTEN_INDIVIDUAL(count, type, typeName, createValue)	\
18697d2f9c0SMichael Lotz void																		\
18797d2f9c0SMichael Lotz TMessageSpeedTest::MessageSpeedTestFlattenIndividual##count##type()			\
18897d2f9c0SMichael Lotz {																			\
18997d2f9c0SMichael Lotz 	BMessage message;														\
19097d2f9c0SMichael Lotz 																			\
19197d2f9c0SMichael Lotz 	for (int32 i = 0; i < count; i++) {										\
19297d2f9c0SMichael Lotz 		createValue;														\
19397d2f9c0SMichael Lotz 		BString name = "data";												\
19497d2f9c0SMichael Lotz 		name << i;															\
19597d2f9c0SMichael Lotz 		message.Add##type(name.String(), value);							\
19697d2f9c0SMichael Lotz 	}																		\
19797d2f9c0SMichael Lotz 																			\
198896d7771SMichael Lotz 	BMallocIO buffer;														\
199896d7771SMichael Lotz 	bigtime_t stamp = real_time_clock_usecs();								\
200896d7771SMichael Lotz 	message.Flatten(&buffer);												\
201896d7771SMichael Lotz 	bigtime_t length = real_time_clock_usecs() - stamp;						\
202896d7771SMichael Lotz 																			\
20397d2f9c0SMichael Lotz 	BString name = "/tmp/MessageSpeedTestFlattenIndividual";				\
20497d2f9c0SMichael Lotz 	name << count << typeName;												\
20597d2f9c0SMichael Lotz 	BEntry entry(name.String());											\
20697d2f9c0SMichael Lotz 	BFile file(&entry, B_READ_WRITE | B_CREATE_FILE);						\
207896d7771SMichael Lotz 	file.Write(buffer.Buffer(), buffer.BufferLength());						\
20897d2f9c0SMichael Lotz 																			\
20997d2f9c0SMichael Lotz 	cout << "Time to flatten a message containing " << count				\
21097d2f9c0SMichael Lotz 		<< " individual " << typeName << " fields = " << length				\
21197d2f9c0SMichael Lotz 		<< "usec. Giving " << length / count << "usec per item." << endl;	\
21297d2f9c0SMichael Lotz 	LOG(__PRETTY_FUNCTION__, length);										\
213024ef0b8SMichael Lotz }
214024ef0b8SMichael Lotz 
21597d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN_INDIVIDUAL(5, Int32, "int32", int32 value = i);
21697d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN_INDIVIDUAL(50, Int32, "int32", int32 value = i);
21797d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN_INDIVIDUAL(500, Int32, "int32", int32 value = i);
21897d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN_INDIVIDUAL(5000, Int32, "int32", int32 value = i);
219024ef0b8SMichael Lotz 
22097d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN_INDIVIDUAL(5, String, "BString", BString value = "item"; value << i);
22197d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN_INDIVIDUAL(50, String, "BString", BString value = "item"; value << i);
22297d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN_INDIVIDUAL(500, String, "BString", BString value = "item"; value << i);
22397d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_FLATTEN_INDIVIDUAL(5000, String, "BString", BString value = "item"; value << i);
224f75b92e7SJérôme Duval 
22597d2f9c0SMichael Lotz #undef MESSAGE_SPEED_TEST_FLATTEN_INDIVIDUAL
226f75b92e7SJérôme Duval 
227f75b92e7SJérôme Duval 
22897d2f9c0SMichael Lotz #define MESSAGE_SPEED_TEST_UNFLATTEN(count, type, typeName)					\
22997d2f9c0SMichael Lotz void																		\
23097d2f9c0SMichael Lotz TMessageSpeedTest::MessageSpeedTestUnflatten##count##type()					\
23197d2f9c0SMichael Lotz {																			\
23297d2f9c0SMichael Lotz 	BString name = "/tmp/MessageSpeedTestFlatten";							\
23397d2f9c0SMichael Lotz 	name << count << typeName;												\
23497d2f9c0SMichael Lotz 	BEntry entry(name.String());											\
23597d2f9c0SMichael Lotz 	BFile file(&entry, B_READ_ONLY);										\
23697d2f9c0SMichael Lotz 																			\
237896d7771SMichael Lotz 	off_t size = 0;															\
238896d7771SMichael Lotz 	file.GetSize(&size);													\
239896d7771SMichael Lotz 	char *buffer = (char *)malloc(size);									\
240896d7771SMichael Lotz 	file.Read(buffer, size);												\
241896d7771SMichael Lotz 	BMemoryIO stream(buffer, size);											\
242896d7771SMichael Lotz 																			\
24397d2f9c0SMichael Lotz 	BMessage rebuilt;														\
24497d2f9c0SMichael Lotz 	bigtime_t stamp = real_time_clock_usecs();								\
245896d7771SMichael Lotz 	rebuilt.Unflatten(&stream);												\
24697d2f9c0SMichael Lotz 	bigtime_t length = real_time_clock_usecs() - stamp;						\
24797d2f9c0SMichael Lotz 																			\
24897d2f9c0SMichael Lotz 	cout << "Time to unflatten a message containing " << count << " "		\
24997d2f9c0SMichael Lotz 		<< typeName	<< " = " << length << "usec. Giving " << length / count	\
25097d2f9c0SMichael Lotz 		<< "usec per item." << endl;										\
25197d2f9c0SMichael Lotz 	LOG(__PRETTY_FUNCTION__, length);										\
25297d2f9c0SMichael Lotz 																			\
25397d2f9c0SMichael Lotz 	file.Unset();															\
25497d2f9c0SMichael Lotz 	entry.Remove();															\
255024ef0b8SMichael Lotz }
256024ef0b8SMichael Lotz 
25797d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN(5, Int32, "int32");
25897d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN(50, Int32, "int32");
25997d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN(500, Int32, "int32");
26097d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN(5000, Int32, "int32");
261024ef0b8SMichael Lotz 
26297d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN(5, String, "BString");
26397d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN(50, String, "BString");
26497d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN(500, String, "BString");
26597d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN(5000, String, "BString");
266024ef0b8SMichael Lotz 
26797d2f9c0SMichael Lotz #undef MESSAGE_SPEED_TEST_UNFLATTEN
268024ef0b8SMichael Lotz 
26997d2f9c0SMichael Lotz 
27097d2f9c0SMichael Lotz #define MESSAGE_SPEED_TEST_UNFLATTEN_INDIVIDUAL(count, type, typeName)		\
27197d2f9c0SMichael Lotz void																		\
27297d2f9c0SMichael Lotz TMessageSpeedTest::MessageSpeedTestUnflattenIndividual##count##type()		\
27397d2f9c0SMichael Lotz {																			\
27497d2f9c0SMichael Lotz 	BString name = "/tmp/MessageSpeedTestFlattenIndividual";				\
27597d2f9c0SMichael Lotz 	name << count << typeName;												\
27697d2f9c0SMichael Lotz 	BEntry entry(name.String());											\
27797d2f9c0SMichael Lotz 	BFile file(&entry, B_READ_ONLY);										\
27897d2f9c0SMichael Lotz 																			\
279896d7771SMichael Lotz 	off_t size = 0;															\
280896d7771SMichael Lotz 	file.GetSize(&size);													\
281896d7771SMichael Lotz 	char *buffer = (char *)malloc(size);									\
282896d7771SMichael Lotz 	file.Read(buffer, size);												\
283896d7771SMichael Lotz 	BMemoryIO stream(buffer, size);											\
284896d7771SMichael Lotz 																			\
28597d2f9c0SMichael Lotz 	BMessage rebuilt;														\
28697d2f9c0SMichael Lotz 	bigtime_t stamp = real_time_clock_usecs();								\
287896d7771SMichael Lotz 	rebuilt.Unflatten(&stream);												\
28897d2f9c0SMichael Lotz 	bigtime_t length = real_time_clock_usecs() - stamp;						\
28997d2f9c0SMichael Lotz 																			\
290896d7771SMichael Lotz 	cout << "Time to unflatten a message containing " << count				\
291896d7771SMichael Lotz 		<< " individual " << typeName << " fields = " << length				\
292896d7771SMichael Lotz 		<< "usec. Giving " << length / count << "usec per item." << endl;	\
29397d2f9c0SMichael Lotz 	LOG(__PRETTY_FUNCTION__, length);										\
29497d2f9c0SMichael Lotz 																			\
29597d2f9c0SMichael Lotz 	file.Unset();															\
29697d2f9c0SMichael Lotz 	entry.Remove();															\
297024ef0b8SMichael Lotz }
298024ef0b8SMichael Lotz 
29997d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN_INDIVIDUAL(5, Int32, "int32");
30097d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN_INDIVIDUAL(50, Int32, "int32");
30197d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN_INDIVIDUAL(500, Int32, "int32");
30297d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN_INDIVIDUAL(5000, Int32, "int32");
303024ef0b8SMichael Lotz 
30497d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN_INDIVIDUAL(5, String, "BString");
30597d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN_INDIVIDUAL(50, String, "BString");
30697d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN_INDIVIDUAL(500, String, "BString");
30797d2f9c0SMichael Lotz MESSAGE_SPEED_TEST_UNFLATTEN_INDIVIDUAL(5000, String, "BString");
308024ef0b8SMichael Lotz 
30997d2f9c0SMichael Lotz #undef MESSAGE_SPEED_TEST_UNFLATTEN_INDIVIDUAL
310024ef0b8SMichael Lotz 
311024ef0b8SMichael Lotz 
Suite()312f75b92e7SJérôme Duval TestSuite* TMessageSpeedTest::Suite()
313f75b92e7SJérôme Duval {
314f75b92e7SJérôme Duval 	TestSuite* suite = new TestSuite("BMessage::Test of Performance");
315f75b92e7SJérôme Duval 
316f75b92e7SJérôme Duval 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestCreate5Int32);
31797d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestCreate50Int32);
31897d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestCreate500Int32);
31997d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestCreate5000Int32);
32097d2f9c0SMichael Lotz 
32197d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestCreate5String);
32297d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestCreate50String);
32397d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestCreate500String);
32497d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestCreate5000String);
32597d2f9c0SMichael Lotz 
326f75b92e7SJérôme Duval 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestLookup5Int32);
327f75b92e7SJérôme Duval 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestLookup50Int32);
328f75b92e7SJérôme Duval 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestLookup500Int32);
329024ef0b8SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestLookup5000Int32);
33097d2f9c0SMichael Lotz 
33197d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestRead5Int32);
33297d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestRead50Int32);
333f75b92e7SJérôme Duval 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestRead500Int32);
33497d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestRead5000Int32);
33597d2f9c0SMichael Lotz 
33697d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestRead5String);
33797d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestRead50String);
33897d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestRead500String);
33997d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestRead5000String);
34097d2f9c0SMichael Lotz 
341f75b92e7SJérôme Duval 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlatten5Int32);
342f75b92e7SJérôme Duval 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlatten50Int32);
343f75b92e7SJérôme Duval 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlatten500Int32);
344024ef0b8SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlatten5000Int32);
34597d2f9c0SMichael Lotz 
34697d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlatten5String);
34797d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlatten50String);
34897d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlatten500String);
34997d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlatten5000String);
35097d2f9c0SMichael Lotz 
35197d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlattenIndividual5Int32);
35297d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlattenIndividual50Int32);
35397d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlattenIndividual500Int32);
35497d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlattenIndividual5000Int32);
35597d2f9c0SMichael Lotz 
35697d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlattenIndividual5String);
35797d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlattenIndividual50String);
35897d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlattenIndividual500String);
35997d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestFlattenIndividual5000String);
36097d2f9c0SMichael Lotz 
361f75b92e7SJérôme Duval 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflatten5Int32);
362f75b92e7SJérôme Duval 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflatten50Int32);
363f75b92e7SJérôme Duval 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflatten500Int32);
364024ef0b8SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflatten5000Int32);
36597d2f9c0SMichael Lotz 
36697d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflatten5String);
36797d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflatten50String);
36897d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflatten500String);
36997d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflatten5000String);
37097d2f9c0SMichael Lotz 
37197d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflattenIndividual5Int32);
37297d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflattenIndividual50Int32);
37397d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflattenIndividual500Int32);
37497d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflattenIndividual5000Int32);
37597d2f9c0SMichael Lotz 
37697d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflattenIndividual5String);
37797d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflattenIndividual50String);
37897d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflattenIndividual500String);
37997d2f9c0SMichael Lotz 	ADD_TEST4(BMessage, suite, TMessageSpeedTest, MessageSpeedTestUnflattenIndividual5000String);
380f75b92e7SJérôme Duval 
381f75b92e7SJérôme Duval 	return suite;
382f75b92e7SJérôme Duval }
383