summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/demo/Ice/throughput/Client.cpp67
-rw-r--r--cpp/demo/Ice/throughput/Throughput.ice13
-rw-r--r--cpp/demo/Ice/throughput/ThroughputI.h30
3 files changed, 104 insertions, 6 deletions
diff --git a/cpp/demo/Ice/throughput/Client.cpp b/cpp/demo/Ice/throughput/Client.cpp
index 90ca86f48ea..3916c62088b 100644
--- a/cpp/demo/Ice/throughput/Client.cpp
+++ b/cpp/demo/Ice/throughput/Client.cpp
@@ -23,6 +23,7 @@ menu()
"1: sequence of bytes (default)\n"
"2: sequence of strings (\"hello\")\n"
"3: sequence of structs with a string (\"hello\") and a double\n"
+ "4: sequence of structs with two ints and a double\n"
"\n"
"select test to run:\n"
"t: Send sequence as twoway\n"
@@ -62,12 +63,21 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
StringSeq stringSeq(StringSeqSize, "hello");
StringDoubleSeq structSeq(StringDoubleSeqSize);
- for(int i = 0; i < StringDoubleSeqSize; ++i)
+ int i;
+ for(i = 0; i < StringDoubleSeqSize; ++i)
{
structSeq[i].s = "hello";
structSeq[i].d = 3.14;
}
+ FixedSeq fixedSeq(FixedSeqSize);
+ for(i = 0; i < FixedSeqSize; ++i)
+ {
+ fixedSeq[i].i = 0;
+ fixedSeq[i].j = 0;
+ fixedSeq[i].d = 0;
+ }
+
menu();
throughput->ice_ping(); // Initial ping to setup the connection.
@@ -89,7 +99,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
IceUtil::Time tm = IceUtil::Time::now();
const int repetitions = 1000;
- if(c == '1' || c == '2' || c == '3')
+ if(c == '1' || c == '2' || c == '3' || c == '4')
{
currentType = c;
switch(c)
@@ -110,10 +120,17 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
case '3':
{
- cout << "using struct sequences" << endl;
+ cout << "using variable-length struct sequences" << endl;
seqSize = StringDoubleSeqSize;
break;
}
+
+ case '4':
+ {
+ cout << "using fixed-length struct sequences" << endl;
+ seqSize = FixedSeqSize;
+ break;
+ }
}
}
else if(c == 't' || c == 'o' || c == 'r' || c == 'e')
@@ -157,7 +174,13 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
case '3':
{
- cout << " struct";
+ cout << " variable-length struct";
+ break;
+ }
+
+ case '4':
+ {
+ cout << " fixed-length struct";
break;
}
}
@@ -267,6 +290,37 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
}
break;
}
+
+ case '4':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput->sendFixedSeq(fixedSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway->sendFixedSeq(fixedSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput->recvFixedSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput->echoFixedSeq(fixedSeq);
+ break;
+ }
+ }
+ break;
+ }
}
}
@@ -292,6 +346,11 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
wireSize += 8; // Size of double on the wire.
break;
}
+ case '4':
+ {
+ wireSize = 16; // Size of two ints and a double on the wire.
+ break;
+ }
}
double mbit = repetitions * seqSize * wireSize * 8.0 / tm.toMicroSeconds();
if(c == 'e')
diff --git a/cpp/demo/Ice/throughput/Throughput.ice b/cpp/demo/Ice/throughput/Throughput.ice
index 47d3f8c6743..7ad488248a1 100644
--- a/cpp/demo/Ice/throughput/Throughput.ice
+++ b/cpp/demo/Ice/throughput/Throughput.ice
@@ -27,6 +27,15 @@ struct StringDouble
sequence<StringDouble> StringDoubleSeq;
const int StringDoubleSeqSize = 50000;
+struct Fixed
+{
+ int i;
+ int j;
+ double d;
+};
+sequence<Fixed> FixedSeq;
+const int FixedSeqSize = 50000;
+
interface Throughput
{
void sendByteSeq(ByteSeq seq);
@@ -41,6 +50,10 @@ interface Throughput
StringDoubleSeq recvStructSeq();
StringDoubleSeq echoStructSeq(StringDoubleSeq seq);
+ void sendFixedSeq(FixedSeq seq);
+ FixedSeq recvFixedSeq();
+ FixedSeq echoFixedSeq(FixedSeq seq);
+
idempotent void shutdown();
};
diff --git a/cpp/demo/Ice/throughput/ThroughputI.h b/cpp/demo/Ice/throughput/ThroughputI.h
index 628aa12b5b8..4af80dd3a58 100644
--- a/cpp/demo/Ice/throughput/ThroughputI.h
+++ b/cpp/demo/Ice/throughput/ThroughputI.h
@@ -20,13 +20,21 @@ public:
ThroughputI() :
_byteSeq(Demo::ByteSeqSize, 0),
_stringSeq(Demo::StringSeqSize, "hello"),
- _structSeq(Demo::StringDoubleSeqSize)
+ _structSeq(Demo::StringDoubleSeqSize),
+ _fixedSeq(Demo::FixedSeqSize)
{
- for(int i = 0; i < Demo::StringDoubleSeqSize; ++i)
+ int i;
+ for(i = 0; i < Demo::StringDoubleSeqSize; ++i)
{
_structSeq[i].s = "hello";
_structSeq[i].d = 3.14;
}
+ for(i = 0; i < Demo::FixedSeqSize; ++i)
+ {
+ _fixedSeq[i].i = 0;
+ _fixedSeq[i].j = 0;
+ _fixedSeq[i].d = 0;
+ }
}
virtual void
@@ -81,6 +89,23 @@ public:
}
virtual void
+ sendFixedSeq(const Demo::FixedSeq&, const Ice::Current&)
+ {
+ }
+
+ virtual Demo::FixedSeq
+ recvFixedSeq(const Ice::Current&)
+ {
+ return _fixedSeq;
+ }
+
+ virtual Demo::FixedSeq
+ echoFixedSeq(const Demo::FixedSeq& seq, const Ice::Current&)
+ {
+ return seq;
+ }
+
+ virtual void
shutdown(const Ice::Current& c)
{
c.adapter->getCommunicator()->shutdown();
@@ -91,6 +116,7 @@ private:
Demo::ByteSeq _byteSeq;
Demo::StringSeq _stringSeq;
Demo::StringDoubleSeq _structSeq;
+ Demo::FixedSeq _fixedSeq;
};
#endif