diff options
author | Michi Henning <michi@zeroc.com> | 2005-04-12 02:44:29 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2005-04-12 02:44:29 +0000 |
commit | e9a6d921e756257b3b09a98ed1f653efb81e8f8d (patch) | |
tree | 7e7265471bdb53369e4df57ca484e0048afbb205 /cpp/demo/Ice/throughput/Client.cpp | |
parent | Removed volatile throughout. (diff) | |
download | ice-e9a6d921e756257b3b09a98ed1f653efb81e8f8d.tar.bz2 ice-e9a6d921e756257b3b09a98ed1f653efb81e8f8d.tar.xz ice-e9a6d921e756257b3b09a98ed1f653efb81e8f8d.zip |
Added sequence of fixed-length elements to throughput demo.
Diffstat (limited to 'cpp/demo/Ice/throughput/Client.cpp')
-rw-r--r-- | cpp/demo/Ice/throughput/Client.cpp | 67 |
1 files changed, 63 insertions, 4 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') |