diff options
author | Michi Henning <michi@zeroc.com> | 2005-03-01 02:15:10 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2005-03-01 02:15:10 +0000 |
commit | 78d1f963d70c22ce42ee0a547483b27ab9687f1e (patch) | |
tree | 887d34a304c26127c6dc8d7c813a6bf86e21dc54 /cpp/demo/Ice/throughput/Client.cpp | |
parent | Ported new throughput demo from C++. (diff) | |
download | ice-78d1f963d70c22ce42ee0a547483b27ab9687f1e.tar.bz2 ice-78d1f963d70c22ce42ee0a547483b27ab9687f1e.tar.xz ice-78d1f963d70c22ce42ee0a547483b27ab9687f1e.zip |
Changed throughput demo to use Slice constants for sequence lengths. That
way, there won't be any more bugs due to the client and server using
hard-wired constants that go out of sync with each other.
Added calculation of bandwidth to throughput demo for string and struct
sequences.
Changed project setting for glacier2router to generate browse information,
so you can search for symbols in the code with Visual Studio. (All the
other projects use this setting.)
Diffstat (limited to 'cpp/demo/Ice/throughput/Client.cpp')
-rw-r--r-- | cpp/demo/Ice/throughput/Client.cpp | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/cpp/demo/Ice/throughput/Client.cpp b/cpp/demo/Ice/throughput/Client.cpp index da68f5d46e6..c1377c9baf6 100644 --- a/cpp/demo/Ice/throughput/Client.cpp +++ b/cpp/demo/Ice/throughput/Client.cpp @@ -57,16 +57,12 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) } ThroughputPrx throughputOneway = ThroughputPrx::uncheckedCast(throughput->ice_oneway()); - int byteSeqSize = 500000; - int stringSeqSize = 50000; - int structSeqSize = 50000; + ByteSeq byteSeq(ByteSeqSize, 0); - ByteSeq byteSeq(byteSeqSize, 0); + StringSeq stringSeq(StringSeqSize, "hello"); - StringSeq stringSeq(stringSeqSize, "hello"); - - StringDoubleSeq structSeq(structSeqSize); - for(int i = 0; i < structSeqSize; ++i) + StringDoubleSeq structSeq(StringDoubleSeqSize); + for(int i = 0; i < StringDoubleSeqSize; ++i) { structSeq[i].s = "hello"; structSeq[i].d = 3.14; @@ -80,7 +76,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) // By default use byte sequence. // char currentType = '1'; - int seqSize = byteSeqSize; + int seqSize = ByteSeqSize; char c; do @@ -101,21 +97,21 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) case '1': { cout << "using byte sequences" << endl; - seqSize = byteSeqSize; + seqSize = ByteSeqSize; break; } case '2': { cout << "using string sequences" << endl; - seqSize = stringSeqSize; + seqSize = StringSeqSize; break; } case '3': { cout << "using struct sequences" << endl; - seqSize = structSeqSize; + seqSize = StringDoubleSeqSize; break; } } @@ -277,18 +273,32 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) tm = IceUtil::Time::now() - tm; cout << "time for " << repetitions << " sequences: " << tm * 1000 << "ms" << endl; cout << "time per sequence: " << tm * 1000 / repetitions << "ms" << endl; - if(currentType == '1') + int wireSize = 0; + switch(currentType) { - // - // TODO: Calculate rate for strings and structs. - // - double mbit = repetitions * seqSize * 8.0 / tm.toMicroSeconds(); - if(c == 'e') + case '1': + { + wireSize = 1; + break; + } + case '2': { - mbit *= 2; + wireSize = stringSeq[0].size(); + break; } - cout << "throughput: " << mbit << " MBit/s" << endl; + case '3': + { + wireSize = structSeq[0].s.size(); + wireSize += 8; // Size of double on the wire. + break; + } + } + double mbit = repetitions * seqSize * wireSize * 8.0 / tm.toMicroSeconds(); + if(c == 'e') + { + mbit *= 2; } + cout << "throughput: " << mbit << " MBit/s" << endl; } else if(c == 's') { |