00001 00002 /*************************************************************************** 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License as published by * 00006 * the Free Software Foundation; either version 2 of the License, or * 00007 * (at your option) any later version. * 00008 * * 00009 ***************************************************************************/ 00010 00011 #ifndef memorymeasurementH 00012 #define memorymeasurementH 00013 00014 #include <map> 00015 #include "ascstring.h" 00016 #include "itemrepository.h" 00017 00018 00019 00020 class MemoryMeasurement { 00021 00022 class Node { 00023 public: 00024 Node( const ASCString& name ) : usage(0) { this->name = name; }; 00025 ASCString name; 00026 int usage; 00027 deallocating_vector<Node*> childs; 00028 void add( Node* n) { childs.push_back( n ); }; 00029 00030 int sum(); 00031 ASCString prettyPrint( int indent ); 00032 }; 00033 00034 Node root; 00035 00036 template<class T> 00037 Node* measure( ItemRepository<T>& repository ); 00038 00039 00040 public: 00041 MemoryMeasurement() : root("root") {}; 00042 00043 void measureTypes(); 00044 void measure( GameMap* gamemap ); 00045 void measureIcons( ); 00046 ASCString getResult(); 00047 00048 00049 00050 }; 00051 00052 00053 #endif
1.4.2