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 | |
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')
-rw-r--r-- | cpp/demo/Ice/throughput/Client.cpp | 50 | ||||
-rw-r--r-- | cpp/demo/Ice/throughput/Throughput.ice | 3 | ||||
-rw-r--r-- | cpp/demo/Ice/throughput/ThroughputI.h | 8 | ||||
-rwxr-xr-x | cpp/src/Glacier2/glacier2router.dsp | 6 |
4 files changed, 40 insertions, 27 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') { diff --git a/cpp/demo/Ice/throughput/Throughput.ice b/cpp/demo/Ice/throughput/Throughput.ice index 978e43c7194..47d3f8c6743 100644 --- a/cpp/demo/Ice/throughput/Throughput.ice +++ b/cpp/demo/Ice/throughput/Throughput.ice @@ -14,8 +14,10 @@ module Demo { sequence<byte> ByteSeq; +const int ByteSeqSize = 500000; sequence<string> StringSeq; +const int StringSeqSize = 50000; struct StringDouble { @@ -23,6 +25,7 @@ struct StringDouble double d; }; sequence<StringDouble> StringDoubleSeq; +const int StringDoubleSeqSize = 50000; interface Throughput { diff --git a/cpp/demo/Ice/throughput/ThroughputI.h b/cpp/demo/Ice/throughput/ThroughputI.h index 7711e32fe40..628aa12b5b8 100644 --- a/cpp/demo/Ice/throughput/ThroughputI.h +++ b/cpp/demo/Ice/throughput/ThroughputI.h @@ -18,11 +18,11 @@ class ThroughputI : public Demo::Throughput public: ThroughputI() : - _byteSeq(500000, 0), - _stringSeq(50000, "hello"), - _structSeq(50000) + _byteSeq(Demo::ByteSeqSize, 0), + _stringSeq(Demo::StringSeqSize, "hello"), + _structSeq(Demo::StringDoubleSeqSize) { - for(int i = 0; i < 50000; ++i) + for(int i = 0; i < Demo::StringDoubleSeqSize; ++i) { _structSeq[i].s = "hello"; _structSeq[i].d = 3.14; diff --git a/cpp/src/Glacier2/glacier2router.dsp b/cpp/src/Glacier2/glacier2router.dsp index 07e0087ce80..eac58fb5091 100755 --- a/cpp/src/Glacier2/glacier2router.dsp +++ b/cpp/src/Glacier2/glacier2router.dsp @@ -13,7 +13,7 @@ CFG=glacier2router - Win32 Debug !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
-!MESSAGE NMAKE /f "glacier2router.mak" CFG="Glacier2Router - Win32 Debug"
+!MESSAGE NMAKE /f "glacier2router.mak" CFG="glacier2router - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
@@ -74,8 +74,8 @@ PostBuild_Cmds=copy $(OutDir)\$(TargetName).exe ..\..\bin # PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /WX /Gm /GR /GX /Zi /Od /I ".." /I "../../include" /D "_DEBUG" /D "_CONSOLE" /FD /GZ /c
-# SUBTRACT CPP /Fr /YX
+# ADD CPP /nologo /MDd /W3 /WX /Gm /GR /GX /Zi /Od /I ".." /I "../../include" /D "_DEBUG" /D "_CONSOLE" /Fr /FD /GZ /c
+# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
|