This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Formatting fixes for 2 testsuite files.
On Mon, 2004-04-12 at 00:18, Paolo Carlini wrote:
> Dhruv Matani wrote:
>
> >Below meaning? I assume in the other file.
> >
> >
> http://www.m-w.com/
Ok, I literally translated that sentence 'Below meaning' from my
mother-tongue Hindi, and it probably came out all wrong. :-)
I know the meaning of below, but I meant to ask whether you were
referring to the line below the line that you mentioned in the patch
file that I sent.
> >Here is the corrected patch.
> >
> >
> "corrected" but not tested!
Yes ;-) Oops. I wrongly assumed that since the previous patch tested
fine, the current, which was only the removal of a single line would do
now harm, so I didn't test it. Apparently, new_allocator did not have a
corresponding using declaration anywhere.
BTW, are all test-suite files compiled with full optimization? -O3 or
not?
I have attached a tested patch ;-)
--
-Dhruv Matani.
http://www.geocities.com/dhruvbird/
Proud to be a Vegetarian.
http://www.vegetarianstarterkit.com/
http://www.vegkids.com/vegkids/index.html
diff -Nrcp -x '*cvs*' ./testsuite/performance/20_util/allocator/list_sort_search.cc /home/dhruv/projects/new_libstdc++-v3/testsuite/performance/20_util/allocator/list_sort_search.cc
*** ./testsuite/performance/20_util/allocator/list_sort_search.cc 2004-04-03 19:09:16.000000000 +0530
--- /home/dhruv/projects/new_libstdc++-v3/testsuite/performance/20_util/allocator/list_sort_search.cc 2004-04-12 21:02:47.000000000 +0530
***************
*** 27,32 ****
--- 27,36 ----
// 2004-03-11 Dhruv Matani <dhruvbird@HotPOP.com>
+ #include <list>
+ #include <map>
+ #include <algorithm>
+ #include <cstdlib>
#include <typeinfo>
#include <sstream>
#include <ext/mt_allocator.h>
***************
*** 38,113 ****
using namespace std;
using __gnu_cxx::malloc_allocator;
using __gnu_cxx::__mt_alloc;
using __gnu_cxx::bitmap_allocator;
using __gnu_cxx::__pool_alloc;
typedef int test_type;
- using namespace __gnu_cxx;
-
- #include <list>
- #include <map>
- #include <algorithm>
- #include <cstdlib>
- using namespace std;
-
template <typename Alloc>
! int Test_Allocator ()
! {
! typedef list<int, Alloc> My_List;
! My_List il1;
!
! int const Iter = 150000;
!
! int ctr = 3;
! while (ctr--)
! {
! for (int i = 0; i < Iter; ++i)
! il1.push_back (rand()%500001);
!
! //Search for random values that may or may not belong to the list.
! for (int i = 0; i < 50; ++i)
! std::find (il1.begin(), il1.end(), rand()%100001);
! il1.sort ();
! //Search for random values that may or may not belong to the list.
! for (int i = 0; i < 50; ++i)
! {
! typename My_List::iterator _liter = std::find (il1.begin(), il1.end(), rand()%100001);
! if (_liter != il1.end())
! il1.erase (_liter);
! }
! il1.clear ();
! }
! return Iter;
! }
template <typename Alloc>
! void do_test ()
! {
! using namespace __gnu_test;
! int status;
! Alloc obj;
!
! time_counter time;
! resource_counter resource;
! clear_counters(time, resource);
! start_counters(time, resource);
! int test_iterations = Test_Allocator<Alloc>();
! stop_counters(time, resource);
! std::ostringstream comment;
! comment << "iterations: " << test_iterations <<endl;
! comment << "type: " << abi::__cxa_demangle(typeid(obj).name(),
! 0, 0, &status);
! report_header(__FILE__, comment.str());
! report_performance(__FILE__, string(), time, resource);
! }
! int main ()
{
#ifdef TEST_S0
do_test<new_allocator<int> >();
--- 42,111 ----
using namespace std;
using __gnu_cxx::malloc_allocator;
+ using __gnu_cxx::new_allocator;
using __gnu_cxx::__mt_alloc;
using __gnu_cxx::bitmap_allocator;
using __gnu_cxx::__pool_alloc;
typedef int test_type;
template <typename Alloc>
! int
! Test_Allocator()
! {
! typedef list<int, Alloc> My_List;
! My_List il1;
! int const Iter = 150000;
!
! int ctr = 3;
! while (ctr--)
! {
! for (int i = 0; i < Iter; ++i)
! il1.push_back(rand()%500001);
!
! //Search for random values that may or may not belong to the list.
! for (int i = 0; i < 50; ++i)
! std::find(il1.begin(), il1.end(), rand()%100001);
! il1.sort();
! //Search for random values that may or may not belong to the list.
! for (int i = 0; i < 50; ++i)
! {
! typename My_List::iterator _liter = std::find(il1.begin(), il1.end(), rand()%100001);
! if (_liter != il1.end())
! il1.erase(_liter);
! }
! il1.clear();
! }
! return Iter;
! }
template <typename Alloc>
! void
! do_test()
! {
! using namespace __gnu_test;
! int status;
! Alloc obj;
!
! time_counter time;
! resource_counter resource;
! clear_counters(time, resource);
! start_counters(time, resource);
! int test_iterations = Test_Allocator<Alloc>();
! stop_counters(time, resource);
! std::ostringstream comment;
! comment << "iterations: " << test_iterations << '\t';
! comment << "type: " << abi::__cxa_demangle(typeid(obj).name(),
! 0, 0, &status);
! report_header(__FILE__, comment.str());
! report_performance(__FILE__, string(), time, resource);
! }
! int main()
{
#ifdef TEST_S0
do_test<new_allocator<int> >();
diff -Nrcp -x '*cvs*' ./testsuite/performance/20_util/allocator/map_mt_find.cc /home/dhruv/projects/new_libstdc++-v3/testsuite/performance/20_util/allocator/map_mt_find.cc
*** ./testsuite/performance/20_util/allocator/map_mt_find.cc 2004-04-03 19:09:16.000000000 +0530
--- /home/dhruv/projects/new_libstdc++-v3/testsuite/performance/20_util/allocator/map_mt_find.cc 2004-04-12 21:03:02.000000000 +0530
***************
*** 32,38 ****
#include <cstdlib>
#include <string>
#include <pthread.h>
-
#include <typeinfo>
#include <sstream>
#include <ext/mt_allocator.h>
--- 32,37 ----
***************
*** 44,60 ****
using namespace std;
using __gnu_cxx::malloc_allocator;
using __gnu_cxx::__mt_alloc;
using __gnu_cxx::bitmap_allocator;
using __gnu_cxx::__pool_alloc;
typedef int test_type;
! using namespace __gnu_cxx;
! using namespace std;
!
! bool less_int (int x1, int x2) { return x1<x2; }
!
#if defined USE_FUNCTION_COMPARE
#define COMPARE_T typeof(&less_int)
--- 43,56 ----
using namespace std;
using __gnu_cxx::malloc_allocator;
+ using __gnu_cxx::new_allocator;
using __gnu_cxx::__mt_alloc;
using __gnu_cxx::bitmap_allocator;
using __gnu_cxx::__pool_alloc;
typedef int test_type;
! bool less_int(int x1, int x2) { return x1<x2; }
#if defined USE_FUNCTION_COMPARE
#define COMPARE_T typeof(&less_int)
*************** bool less_int (int x1, int x2) { return
*** 65,137 ****
#endif
template <typename Alloc>
! void *find_proc (void *_vptr)
! {
! map<int, string, COMPARE_T, Alloc> *_mptr =
! reinterpret_cast<map<int, string, COMPARE_T, Alloc>*>(_vptr);
!
! for (int i = 0; i < 700000; ++i)
! {
! int Finder = rand() % 2000000;
! _mptr->find (Finder);
! }
! return _vptr;
! }
template <typename Alloc>
! int do_test ()
! {
! COMPARE_T _comp = COMPARE_F;
! map<int, string, COMPARE_T, Alloc> imap (_comp);
! int x = 2;
! pthread_t thr[3];
! const int Iter = 1000000;
!
! while (x--)
! {
! for (int i = 0; i < 300000; ++i)
! imap.insert (make_pair (rand()%1000000, "_test_data"));
!
! for (int i = 0; i < 100000; ++i)
! imap.insert (make_pair (rand()%2000000, "_test_data"));
!
! pthread_create (&thr[0], NULL, find_proc<Alloc>, (void*)&imap);
! pthread_create (&thr[1], NULL, find_proc<Alloc>, (void*)&imap);
! pthread_create (&thr[2], NULL, find_proc<Alloc>, (void*)&imap);
!
! pthread_join (thr[0], 0);
! pthread_join (thr[1], 0);
! pthread_join (thr[2], 0);
!
! imap.clear ();
! }
! return Iter;
! }
template <typename Alloc>
! void exec_tests ()
! {
! using namespace __gnu_test;
! int status;
! COMPARE_T _comp = COMPARE_F;
! map<int, string, COMPARE_T, Alloc> obj (_comp);
!
! time_counter time;
! resource_counter resource;
! clear_counters(time, resource);
! start_counters(time, resource);
! int test_iterations = do_test<Alloc>();
! stop_counters(time, resource);
! std::ostringstream comment;
! comment << "iterations: " << test_iterations <<endl;
! comment << "type: " << abi::__cxa_demangle(typeid(obj).name(),
! 0, 0, &status);
! report_header(__FILE__, comment.str());
! report_performance(__FILE__, string(), time, resource);
! }
!
int main()
{
--- 61,135 ----
#endif
template <typename Alloc>
! void*
! find_proc(void *_vptr)
! {
! map<int, string, COMPARE_T, Alloc> *_mptr =
! reinterpret_cast<map<int, string, COMPARE_T, Alloc>*>(_vptr);
!
! for (int i = 0; i < 700000; ++i)
! {
! int Finder = rand() % 2000000;
! _mptr->find(Finder);
! }
! return _vptr;
! }
template <typename Alloc>
! int
! do_test()
! {
! COMPARE_T _comp = COMPARE_F;
! map<int, string, COMPARE_T, Alloc> imap(_comp);
! int x = 2;
! pthread_t thr[3];
! const int Iter = 1000000;
!
! while (x--)
! {
! for (int i = 0; i < 300000; ++i)
! imap.insert(make_pair(rand()%1000000, "_test_data"));
!
! for (int i = 0; i < 100000; ++i)
! imap.insert(make_pair(rand()%2000000, "_test_data"));
!
! pthread_create(&thr[0], NULL, find_proc<Alloc>, (void*)&imap);
! pthread_create(&thr[1], NULL, find_proc<Alloc>, (void*)&imap);
! pthread_create(&thr[2], NULL, find_proc<Alloc>, (void*)&imap);
!
! pthread_join(thr[0], 0);
! pthread_join(thr[1], 0);
! pthread_join(thr[2], 0);
!
! imap.clear();
! }
! return Iter;
! }
template <typename Alloc>
! void
! exec_tests()
! {
! using namespace __gnu_test;
! int status;
! COMPARE_T _comp = COMPARE_F;
! map<int, string, COMPARE_T, Alloc> obj(_comp);
!
! time_counter time;
! resource_counter resource;
! clear_counters(time, resource);
! start_counters(time, resource);
! int test_iterations = do_test<Alloc>();
! stop_counters(time, resource);
! std::ostringstream comment;
! comment << "iterations: " << test_iterations << '\t';
! comment << "type: " << abi::__cxa_demangle(typeid(obj).name(),
! 0, 0, &status);
! report_header(__FILE__, comment.str());
! report_performance(__FILE__, string(), time, resource);
! }
int main()
{