From 42ec3e439466851ff7225d0eba11d6184490bd5b Mon Sep 17 00:00:00 2001 From: khizmax Date: Mon, 26 Jan 2015 23:28:25 +0300 Subject: [PATCH] Add total perf counters to set/map ins/del/find tests --- tests/unit/map2/map_insdelfind.cpp | 8 ++++++-- tests/unit/set2/set_insdelfind.cpp | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/unit/map2/map_insdelfind.cpp b/tests/unit/map2/map_insdelfind.cpp index fe051ced..60a925e8 100644 --- a/tests/unit/map2/map_insdelfind.cpp +++ b/tests/unit/map2/map_insdelfind.cpp @@ -142,7 +142,7 @@ namespace map2 { CppUnitMini::ThreadPool pool( *this ); pool.add( new work_thread( pool, testMap ), c_nThreadCount ); pool.run( c_nDuration ); - CPPUNIT_MSG( " Duration=" << pool.avgDuration() ); + //CPPUNIT_MSG( " Duration=" << pool.avgDuration() ); size_t nInsertSuccess = 0; size_t nInsertFailed = 0; @@ -152,7 +152,7 @@ namespace map2 { size_t nFindFailed = 0; for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) { work_thread * pThread = static_cast( *it ); - assert( pThread != NULL ); + assert( pThread != nullptr ); nInsertSuccess += pThread->m_nInsertSuccess; nInsertFailed += pThread->m_nInsertFailed; nDeleteSuccess += pThread->m_nDeleteSuccess; @@ -161,12 +161,16 @@ namespace map2 { nFindFailed += pThread->m_nFindFailed; } + size_t nTotalOps = nInsertSuccess + nInsertFailed + nDeleteSuccess + nDeleteFailed + nFindSuccess + nFindFailed; + CPPUNIT_MSG( " Totals (success/failed): \n\t" << " Insert=" << nInsertSuccess << '/' << nInsertFailed << "\n\t" << " Delete=" << nDeleteSuccess << '/' << nDeleteFailed << "\n\t" << " Find=" << nFindSuccess << '/' << nFindFailed << "\n\t" << " Speed=" << (nFindSuccess + nFindFailed) / c_nDuration << " find/sec\n\t" << " " << (nInsertSuccess + nDeleteSuccess) / c_nDuration << " modify/sec\n\t" + << " Total ops=" << nTotalOps << "\n\t" + << " speed=" << nTotalOps / c_nDuration << " ops/sec\n\t" << " Map size=" << testMap.size() ); diff --git a/tests/unit/set2/set_insdelfind.cpp b/tests/unit/set2/set_insdelfind.cpp index 88a18999..0d4d5f45 100644 --- a/tests/unit/set2/set_insdelfind.cpp +++ b/tests/unit/set2/set_insdelfind.cpp @@ -169,12 +169,16 @@ namespace set2 { nFindFailed += pThread->m_nFindFailed; } + size_t nTotalOps = nInsertSuccess + nInsertFailed + nDeleteSuccess + nDeleteFailed + nFindSuccess + nFindFailed; + CPPUNIT_MSG( " Totals (success/failed): \n\t" << " Insert=" << nInsertSuccess << '/' << nInsertFailed << "\n\t" << " Delete=" << nDeleteSuccess << '/' << nDeleteFailed << "\n\t" << " Find=" << nFindSuccess << '/' << nFindFailed << "\n\t" << " Speed=" << (nFindSuccess + nFindFailed) / c_nDuration << " find/sec\n\t" << " " << (nInsertSuccess + nDeleteSuccess) / c_nDuration << " modify/sec\n\t" + << " Total ops=" << nTotalOps << "\n\t" + << " speed=" << nTotalOps / c_nDuration << " ops/sec\n\t" << " Set size=" << testSet.size() ); -- 2.34.1