Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Indexer.cc

    r79de2210 red34540  
    2626#include "Common/SemanticError.h"  // for SemanticError
    2727#include "Common/utility.h"        // for cloneAll
    28 #include "Common/Stats/Counter.h" // for counters
    2928#include "GenPoly/GenPoly.h"
    3029#include "InitTweak/InitTweak.h"   // for isConstructor, isCopyFunction, isC...
     
    4241
    4342namespace SymTab {
    44 
    45         // Statistics block
    46         namespace {
    47                 auto idtable_group = new Stats::Counters::CounterGroup("IdTable");
    48                 auto idtable_find  = new Stats::Counters::SimpleCounter("Find calls", idtable_group);
    49                 auto idtable_size  = new Stats::Counters::AverageCounter<double>("Average Size", idtable_group);
    50                 auto idtable_key   = new Stats::Counters::AverageCounter<double>("Average Key Size", idtable_group);
    51 
    52                 auto indexers_group = new Stats::Counters::CounterGroup("Indexers");
    53                 auto indexers_count = new Stats::Counters::SimpleCounter("Count", indexers_group);
    54                 auto indexers_size  = new Stats::Counters::AverageCounter<double>("Average Size", indexers_group);
    55                 auto indexers_depth_a  = new Stats::Counters::AverageCounter<double>("Average Depth", indexers_group);
    56                 auto indexers_depth_m  = new Stats::Counters::MaxCounter<size_t>("Max Depth", indexers_group);
    57         }
    58 
    5943        std::ostream & operator<<( std::ostream & out, const Indexer::IdData & data ) {
    6044                return out << "(" << data.id << "," << data.baseExpr << ")";
     
    213197        }
    214198
    215         Indexer::Indexer() : tables( 0 ), scope( 0 ) {
    216                 (*indexers_count)++;
    217         }
    218 
    219         Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) {
    220                 (*indexers_count)++;
    221         }
     199        Indexer::Indexer() : tables( 0 ), scope( 0 ) {}
     200
     201        Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) {}
    222202
    223203        Indexer::Indexer( Indexer &&that ) : doDebug( that.doDebug ), tables( that.tables ), scope( that.scope ) {
     
    226206
    227207        Indexer::~Indexer() {
    228                 if(tables) {
    229                         indexers_size->push( tables->idTable.size() );
    230                         size_t depth = 1;
    231                         for( auto crnt = tables->base.tables; crnt; crnt = crnt->base.tables ) {
    232                                 ++depth;
    233                         }
    234                         indexers_depth_a->push( depth );
    235                         indexers_depth_m->push( depth );
    236                 }
    237208                deleteRef( tables );
    238209        }
     
    266237                while ( searchTables ) {
    267238
    268                         (*idtable_find)++;
    269                         idtable_key->push( id.size() );
    270                         idtable_size->push( searchTables->idTable.size() );
    271239                        IdTable::const_iterator decls = searchTables->idTable.find( id );
    272240                        if ( decls != searchTables->idTable.end() ) {
     
    345313                if ( tables->scope < scope ) return nullptr;
    346314
    347                 (*idtable_find)++;
    348                 idtable_key->push( id.size() );
    349                 idtable_size->push( tables->idTable.size() );
    350315                IdTable::const_iterator decls = tables->idTable.find( id );
    351316                if ( decls != tables->idTable.end() ) {
     
    366331                if ( tables->scope < scope ) return false;
    367332
    368                 (*idtable_find)++;
    369                 idtable_key->push( id.size() );
    370                 idtable_size->push( tables->idTable.size() );
    371333                IdTable::const_iterator decls = tables->idTable.find( id );
    372334                if ( decls != tables->idTable.end() ) {
     
    385347                if ( tables->scope < scope ) return false;
    386348
    387                 (*idtable_find)++;
    388                 idtable_key->push( id.size() );
    389                 idtable_size->push( tables->idTable.size() );
    390349                IdTable::const_iterator decls = tables->idTable.find( id );
    391350                if ( decls != tables->idTable.end() ) {
Note: See TracChangeset for help on using the changeset viewer.