9f9900dbb6
2006-10-03 Benjamin Kosnik <bkoz@redhat.com> * testsuite/util/testsuite_allocator.h (allocation_tracker): To tracker_allocator_counter. (allocation_tracker::allocationTotal): To get_allocation_count. (allocation_tracker::deallocationTotal): To get_deallocation_count. (allocation_tracker::constructCount): To get_construct_count. (allocation_tracker::destructCount): To get_destruct_count. (allocation_tracker::resetCounts): To reset. (tracker_alloc): To tracker_allocator. * testsuite/util/performance/mem: Remove. * testsuite/util/performance/mem/mem_track_allocator_base.hpp: Remove. * testsuite/util/performance/mem/mem_track_allocator.hpp: Remove. * testsuite/27_io/basic_stringbuf/4.cc: Adjust for new names or includes. * testsuite/ext/hash_set/check_construct_destroy.cc: Same. * testsuite/ext/slist/check_construct_destroy.cc: Same. * testsuite/performance/ext/pb_ds/ hash_random_int_erase_mem_usage.cc: Same. * testsuite/performance/ext/pb_ds/multimap_text_insert_mem_usage.hpp * testsuite/performance/ext/pb_ds/ priority_queue_text_pop_mem_usage.cc: Same. * testsuite/23_containers/vector/capacity/2.cc: Same. * testsuite/23_containers/vector/cons/4.cc: Same. * testsuite/23_containers/vector/check_construct_destroy.cc: Same. * testsuite/23_containers/deque/cons/2.cc: Same. * testsuite/23_containers/deque/check_construct_destroy.cc: Same. * testsuite/23_containers/list/check_construct_destroy.cc: Same. * testsuite/23_containers/set/check_construct_destroy.cc: Same. * testsuite/util/testsuite_allocator.h * testsuite/util/performance/priority_queue/mem_usage/pop_test.hpp * testsuite/util/performance/assoc/mem_usage/multimap_insert_test.hpp * testsuite/util/performance/assoc/mem_usage/erase_test.hpp * testsuite/util/testsuite_allocator.cc: Same. From-SVN: r117408
66 lines
2.3 KiB
C++
66 lines
2.3 KiB
C++
// -*- C++ -*-
|
|
// Testing allocator for the C++ library testsuite.
|
|
//
|
|
// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
|
//
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
|
// software; you can redistribute it and/or modify it under the
|
|
// terms of the GNU General Public License as published by the
|
|
// Free Software Foundation; either version 2, or (at your option)
|
|
// any later version.
|
|
//
|
|
// This library is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License along
|
|
// with this library; see the file COPYING. If not, write to the Free
|
|
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
// USA.
|
|
//
|
|
// As a special exception, you may use this file as part of a free software
|
|
// library without restriction. Specifically, if other files instantiate
|
|
// templates or use macros or inline functions from this file, or you compile
|
|
// this file and link it with other files to produce an executable, this
|
|
// file does not by itself cause the resulting executable to be covered by
|
|
// the GNU General Public License. This exception does not however
|
|
// invalidate any other reasons why the executable file might be covered by
|
|
// the GNU General Public License.
|
|
|
|
#include <iostream>
|
|
#include <testsuite_allocator.h>
|
|
|
|
namespace __gnu_test
|
|
{
|
|
typedef tracker_allocator_counter counter_type;
|
|
|
|
counter_type::size_type
|
|
counter_type::allocationCount_ = 0;
|
|
|
|
counter_type::size_type
|
|
counter_type::deallocationCount_ = 0;
|
|
|
|
int counter_type::constructCount_ = 0;
|
|
int counter_type::destructCount_ = 0;
|
|
|
|
bool
|
|
check_construct_destroy(const char* tag, int expected_c, int expected_d)
|
|
{
|
|
bool ret = true;
|
|
if (counter_type::get_construct_count() != expected_c
|
|
|| counter_type::get_destruct_count() != expected_d)
|
|
{
|
|
std::cerr << tag << ": "
|
|
<< " construct = " << counter_type::get_construct_count()
|
|
<< " (should be " << expected_c << "),"
|
|
<< " destroy = " << counter_type::get_destruct_count()
|
|
<< " (should be " << expected_d << ")"
|
|
<< std::endl;
|
|
ret = false;
|
|
}
|
|
return ret;
|
|
}
|
|
}; // namespace __cxx_test
|
|
|