From 00052a60c929f00c628b9cc367f35feb1c9ad6e7 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Thu, 5 Jan 2012 11:29:17 -0600 Subject: [PATCH] add container_test --- CHANGELOG.txt | 11 ++++ container_test.cpp | 131 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 container_test.cpp diff --git a/CHANGELOG.txt b/CHANGELOG.txt index bec6b43664..06fc99cac5 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,9 +1,20 @@ + +2012-Jan-5 UPDATE Dick Hollenbeck +================================================================================ +++all + Ki_PageDescr was re-written as a proper C++ class and renamed to PAGE_INFO. + It describes paper. The m_Offset field was dropped since it was only used + in HPGL plotting within EESCHEMA. PAGE_INFO instance was moved out of + BASE_SCREEN (which is on its way out) into both SCH_SCREEN and BOARD. + + KiCad ChangeLog 2011 ==================== Please add newer entries at the top, list the date and your name with email address. + 2011-Dec-19, UPDATE Jean-Pierre Charras ================================================================================ Pcbnew: diff --git a/container_test.cpp b/container_test.cpp new file mode 100644 index 0000000000..cec4cea43c --- /dev/null +++ b/container_test.cpp @@ -0,0 +1,131 @@ + +#include +#include +#include +#include +#include + + +#define TEST_NODES 100000000 + + +//typedef std::vector EDA_ITEMV; +//typedef std::deque EDA_ITEMV; +typedef boost::ptr_vector EDA_ITEMV; + + +void heap_warm_up(); + + +/** + * Function GetRunningMicroSecs + * returns current relative time in microsecs. + */ +unsigned GetRunningMicroSecs() +{ + struct timespec now; + + clock_gettime( CLOCK_MONOTONIC, &now ); + + unsigned usecs = now.tv_nsec/1000 + now.tv_sec * 1000 * 1000; + return usecs; +} + + +int main( int argc, char** argv ) +{ + EDA_ITEMV v; + DLIST dlist; + + unsigned vAllocStart; + unsigned vAllocStop; + unsigned vIterateStart; + unsigned vIterateStop; + + unsigned dAllocStart; + unsigned dAllocStop; + unsigned dIterateStart; + unsigned dIterateStop; + + heap_warm_up(); + + vAllocStart = GetRunningMicroSecs(); + + for( int i=0; iType() == -22 ) + { + printf( "never this\n" ); + break; + } + } + + vIterateStop = GetRunningMicroSecs(); + +#if 0 + for( int i=0; iNext() ) + { + if( it->Type() == -22 ) + { + printf( "never this\n" ); + break; + } + } + + dIterateStop = GetRunningMicroSecs(); + + printf( "vector alloc: %u usecs iterate: %u usecs\n", + vAllocStop - vAllocStart, + vIterateStop - vIterateStart ); + + printf( "dlist alloc: %u usecs iterate: %u usecs\n", + dAllocStop - dAllocStart, + dIterateStop - dIterateStart ); +} + + +void heap_warm_up() +{ + // dry run allocate enough object for process to obtain all memory needed + + EDA_ITEMV vec; + + for( int i=0; i