File: memory-measurement.h

package info (click to toggle)
asc 2.6.1.0-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 81,740 kB
  • sloc: cpp: 158,704; sh: 11,544; ansic: 6,736; makefile: 604; perl: 138
file content (53 lines) | stat: -rw-r--r-- 1,481 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

/***************************************************************************
 *                                                                         *
 *   This program 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 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef memorymeasurementH
 #define memorymeasurementH
 
#include <map>
#include "ascstring.h"
#include "itemrepository.h"

 
 
 class MemoryMeasurement {
   
     class Node {
        public:
           Node( const ASCString& name ) : usage(0) { this->name = name; };
           ASCString name;
           int usage;
           deallocating_vector<Node*> childs;
           void add( Node* n) { childs.push_back( n ); };
           
           int sum();
           ASCString prettyPrint( int indent );
     };
   
     Node root;
     
     template<class T>
     Node* measure(  ItemRepository<T>& repository );
     
     
    public:
       MemoryMeasurement() : root("root")  {};
       
       void measureTypes();
       void measure( GameMap* gamemap );
       void measureIcons( );
       ASCString getResult();
       
       
       
 };
 
 
#endif