test/test_memory.cpp

Go to the documentation of this file.
00001 //
00002 // C++ Implementation: test_romberg
00003 //
00004 // Description: unit tests for memory footprint routines
00005 //
00006 //
00007 // Author: Roman Geus <geus@maxwell>, (C) 2004
00008 //
00009 // Copyright: See COPYING file that comes with this distribution
00010 //
00011 //
00012 
00013 #include <tut.h>
00014 #include "myrlog.h"
00015 #include "adaptsim.h"
00016 
00017 namespace
00018 {
00019 
00020     struct test_data
00021     {
00022         test_data()
00023         {
00024         }
00025     };
00026 
00027     typedef tut::test_group<test_data> testgroup;
00028     typedef testgroup::object testobject;
00029     testgroup group("memory");
00030 
00031     template<>
00032     template<>
00033     void testobject::test<1>()
00034     {
00035         const size_t alloc_size = 1024*1024*64;
00036         size_t before, after, diff;
00037         before = get_mem_footprint();
00038         char* p = new char[alloc_size];
00039         after = get_mem_footprint();
00040         diff = after - before;
00041         rInfo("diff = %lu", static_cast<unsigned long>(diff));
00042         delete p;
00043         ensure(diff > 60*1024*1024);
00044         ensure(diff < 65*1024*1024);
00045     }
00046 
00047     template<>
00048     template<>
00049     void testobject::test<2>()
00050     {
00051         const size_t alloc_size = 512*1024;
00052         size_t before, after, diff;
00053         before = get_mem_footprint();
00054         char* p = new char[alloc_size];
00055         after = get_mem_footprint();
00056         diff = after - before;
00057         rInfo("diff = %lu", static_cast<unsigned long>(diff));
00058         delete p;
00059         ensure(diff > 500*1024);
00060         ensure(diff < 520*1024);
00061     }
00062 
00063 }

Generated on Fri Oct 26 13:35:13 2007 for FEMAXX (Finite Element Maxwell Eigensolver) by  doxygen 1.4.7