diff options
author | Marc Laukien <marc@zeroc.com> | 2004-10-06 17:53:00 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2004-10-06 17:53:00 +0000 |
commit | 7dc2a0cec8c09723ea9efc241c01db678dfdc73f (patch) | |
tree | 42d788203c8a701f52ed0babe099db564eb2d4ce /cpp | |
parent | fixes (diff) | |
download | ice-7dc2a0cec8c09723ea9efc241c01db678dfdc73f.tar.bz2 ice-7dc2a0cec8c09723ea9efc241c01db678dfdc73f.tar.xz ice-7dc2a0cec8c09723ea9efc241c01db678dfdc73f.zip |
time changes
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/demo/Freeze/backup/Client.cpp | 2 | ||||
-rw-r--r-- | cpp/demo/Freeze/bench/Client.cpp | 78 | ||||
-rw-r--r-- | cpp/demo/Ice/latency/Client.cpp | 4 | ||||
-rw-r--r-- | cpp/demo/Ice/throughput/Client.cpp | 4 | ||||
-rw-r--r-- | cpp/include/IceUtil/Time.h | 2 | ||||
-rw-r--r-- | cpp/src/Ice/CommunicatorI.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Ice/Instance.cpp | 3 | ||||
-rw-r--r-- | cpp/src/IceUtil/Time.cpp | 6 |
8 files changed, 54 insertions, 49 deletions
diff --git a/cpp/demo/Freeze/backup/Client.cpp b/cpp/demo/Freeze/backup/Client.cpp index 8616b5baf73..aba5a002bab 100644 --- a/cpp/demo/Freeze/backup/Client.cpp +++ b/cpp/demo/Freeze/backup/Client.cpp @@ -27,8 +27,6 @@ testFailed(const char* expr, const char* file, unsigned int line) #define test(ex) ((ex) ? ((void)0) : testFailed(#ex, __FILE__, __LINE__)) - - int main(int argc, char* argv[]) { diff --git a/cpp/demo/Freeze/bench/Client.cpp b/cpp/demo/Freeze/bench/Client.cpp index 60e4a675add..19d57a514a9 100644 --- a/cpp/demo/Freeze/bench/Client.cpp +++ b/cpp/demo/Freeze/bench/Client.cpp @@ -179,8 +179,8 @@ private: IceUtil::Time total = _watch.stop(); IceUtil::Time perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " writes: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per write: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl; + cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl; // // Read each record. @@ -195,8 +195,8 @@ private: total = _watch.stop(); perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " reads: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per read: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << _repetitions << " reads: " << total * 1000 << "ms" << endl; + cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl; // // Optional index sub-test @@ -218,8 +218,8 @@ private: total = _watch.stop(); perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " removes: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per remove: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl; + cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl; } @@ -239,9 +239,9 @@ private: IceUtil::Time total = _watch.stop(); IceUtil::Time perRecord = total / reads; - cout << "\ttime for " << reads << " reads of " << gen->toString() << " records: " - << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per read: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << reads << " reads of " << gen->toString() << " records: " << total * 1000 << "ms" + << endl; + cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl; generatedReadWithIndex(m, reads, gen); } @@ -282,8 +282,8 @@ private: IceUtil::Time total = _watch.stop(); IceUtil::Time perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " writes: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per write: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl; + cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl; // // Read each record. @@ -301,8 +301,8 @@ private: total = _watch.stop(); perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " reads: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per read: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << _repetitions << " reads: " << total * 1000 << "ms" << endl; + cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl; // // Optional index test @@ -325,8 +325,8 @@ private: total = _watch.stop(); perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " removes: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per remove: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl; + cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl; } @@ -363,8 +363,8 @@ private: IceUtil::Time total = _watch.stop(); IceUtil::Time perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " writes: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per write: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl; + cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl; // // Read each record. @@ -382,8 +382,8 @@ private: total = _watch.stop(); perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " reads: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per read: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << _repetitions << " reads: " << total * 1000 << "ms" << endl; + cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl; // // Optional index test @@ -407,8 +407,8 @@ private: total = _watch.stop(); perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " removes: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per remove: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl; + cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl; } void IntIntMapReadIndexTest(IntIntMap&) @@ -438,8 +438,8 @@ private: IceUtil::Time total = _watch.stop(); IceUtil::Time perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " writes: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per write: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl; + cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl; // // Do some read tests. @@ -469,8 +469,8 @@ private: total = _watch.stop(); perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " removes: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per remove: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl; + cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl; */ } @@ -505,9 +505,9 @@ TestApp::IntIntMapIndexTest(IndexedIntIntMap& m) IceUtil::Time total = _watch.stop(); IceUtil::Time perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " reverse (indexed) reads: " << total.toMicroSeconds() / 1000.0 << "ms" + cout << "\ttime for " << _repetitions << " reverse (indexed) reads: " << total * 1000 << "ms" << endl; - cout << "\ttime per reverse read: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime per reverse read: " << perRecord * 1000 << "ms" << endl; } void @@ -525,8 +525,8 @@ TestApp::generatedReadWithIndex(IndexedIntIntMap& m, int reads, const GeneratorP IceUtil::Time perRecord = total / reads; cout << "\ttime for " << reads << " reverse (indexed) reads of " << gen->toString() << " records: " - << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per reverse read: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + << total * 1000 << "ms" << endl; + cout << "\ttime per reverse read: " << perRecord * 1000 << "ms" << endl; } @@ -559,8 +559,8 @@ TestApp::Struct1Struct2MapIndexTest(IndexedStruct1Struct2Map& m) IceUtil::Time total = _watch.stop(); IceUtil::Time perRecord = total / (2 *_repetitions); - cout << "\ttime for " << 2 *_repetitions << " indexed reads: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per indexed read: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << 2 *_repetitions << " indexed reads: " << total * 1000 << "ms" << endl; + cout << "\ttime per indexed read: " << perRecord * 1000 << "ms" << endl; } void @@ -582,8 +582,8 @@ TestApp::Struct1Class1MapIndexTest(IndexedStruct1Class1Map& m) IceUtil::Time total = _watch.stop(); IceUtil::Time perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " indexed reads: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per indexed read: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << _repetitions << " indexed reads: " << total * 1000 << "ms" << endl; + cout << "\ttime per indexed read: " << perRecord * 1000 << "ms" << endl; } @@ -627,8 +627,8 @@ TestApp::Struct1ObjectMapTest() IceUtil::Time total = _watch.stop(); IceUtil::Time perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " writes: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per write: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << _repetitions << " writes: " << total * 1000 << "ms" << endl; + cout << "\ttime per write: " << perRecord * 1000 << "ms" << endl; // // Read each record. @@ -661,8 +661,8 @@ TestApp::Struct1ObjectMapTest() total = _watch.stop(); perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " reads: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per read: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << _repetitions << " reads: " << total * 1000 << "ms" << endl; + cout << "\ttime per read: " << perRecord * 1000 << "ms" << endl; // // Remove each record. @@ -680,8 +680,8 @@ TestApp::Struct1ObjectMapTest() total = _watch.stop(); perRecord = total / _repetitions; - cout << "\ttime for " << _repetitions << " removes: " << total.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "\ttime per remove: " << perRecord.toMicroSeconds() / 1000.0 << "ms" << endl; + cout << "\ttime for " << _repetitions << " removes: " << total * 1000 << "ms" << endl; + cout << "\ttime per remove: " << perRecord * 1000 << "ms" << endl; } class MyFactory : public Ice::ObjectFactory diff --git a/cpp/demo/Ice/latency/Client.cpp b/cpp/demo/Ice/latency/Client.cpp index 14dbf3de6c5..1c807e04784 100644 --- a/cpp/demo/Ice/latency/Client.cpp +++ b/cpp/demo/Ice/latency/Client.cpp @@ -47,8 +47,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) tm = IceUtil::Time::now() - tm; - cout << "time for " << repetitions << " pings: " << tm.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "time per ping: " << tm.toMicroSeconds() / 1000.0 / repetitions << "ms" << endl; + cout << "time for " << repetitions << " pings: " << tm * 1000 << "ms" << endl; + cout << "time per ping: " << tm * 1000 / repetitions << "ms" << endl; return EXIT_SUCCESS; } diff --git a/cpp/demo/Ice/throughput/Client.cpp b/cpp/demo/Ice/throughput/Client.cpp index 03e10c4ea1f..29715304863 100644 --- a/cpp/demo/Ice/throughput/Client.cpp +++ b/cpp/demo/Ice/throughput/Client.cpp @@ -128,8 +128,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) } tm = IceUtil::Time::now() - tm; - cout << "time for " << repetitions << " sequences: " << tm.toMicroSeconds() / 1000.0 << "ms" << endl; - cout << "time per sequence: " << tm.toMicroSeconds() / 1000.0 / repetitions << "ms" << endl; + cout << "time for " << repetitions << " sequences: " << tm * 1000 << "ms" << endl; + cout << "time per sequence: " << tm * 1000 / repetitions << "ms" << endl; double mbit = repetitions * seqSize * 8.0 / tm.toMicroSeconds(); if(c == 'e') { diff --git a/cpp/include/IceUtil/Time.h b/cpp/include/IceUtil/Time.h index a2a49b09ee7..9c6fffff5b7 100644 --- a/cpp/include/IceUtil/Time.h +++ b/cpp/include/IceUtil/Time.h @@ -134,6 +134,8 @@ Time operator/(const Time& lhs, T rhs) return Time::microSeconds(static_cast<Int64>(lhs.toMicroSeconds() / rhs)); } +std::ostream& operator<<(std::ostream&, const Time&); + } // End namespace IceUtil #endif diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index 518784fac28..2df2370b4ef 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -59,7 +59,7 @@ printGCStats(const IceUtil::GCStats& stats) if(gcTraceLevel > 1) { Trace out(gcLogger, gcTraceCat); - out << stats.collected << "/" << stats.examined << ", " << stats.time.toMilliSeconds() << "ms"; + out << stats.collected << "/" << stats.examined << ", " << stats.time * 1000 << "ms"; } ++gcStats.runs; gcStats.examined += stats.examined; @@ -108,7 +108,7 @@ Ice::CommunicatorI::destroy() { Trace out(gcLogger, gcTraceCat); out << "totals: " << gcStats.collected << "/" << gcStats.examined << ", " - << gcStats.time.toMilliSeconds() << "ms" << ", " << gcStats.runs << " run"; + << gcStats.time * 1000 << "ms" << ", " << gcStats.runs << " run"; if(gcStats.runs != 1) { out << "s"; diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index a1588e45e68..0d35ecaaf86 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -400,8 +400,7 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Prope } } - unsigned int seed = - static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds()); + unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds()); srand(seed); if(_properties->getPropertyAsInt("Ice.NullHandleAbort") > 0) diff --git a/cpp/src/IceUtil/Time.cpp b/cpp/src/IceUtil/Time.cpp index 934012f16bc..718ae15beae 100644 --- a/cpp/src/IceUtil/Time.cpp +++ b/cpp/src/IceUtil/Time.cpp @@ -110,3 +110,9 @@ Time::Time(Int64 usec) : _usec(usec) { } + +std::ostream& +IceUtil::operator<<(std::ostream& out, const Time& tm) +{ + return out << tm.toMicroSeconds() / 1000000.0; +} |