Changes in src/SymTab/Indexer.cc [1cb7fab2:ed34540]
- File:
-
- 1 edited
-
src/SymTab/Indexer.cc (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Indexer.cc
r1cb7fab2 red34540 26 26 #include "Common/SemanticError.h" // for SemanticError 27 27 #include "Common/utility.h" // for cloneAll 28 #include "Common/Stats/Counter.h" // for counters29 28 #include "GenPoly/GenPoly.h" 30 29 #include "InitTweak/InitTweak.h" // for isConstructor, isCopyFunction, isC... … … 42 41 43 42 namespace SymTab { 44 45 // Statistics block46 namespace {47 48 static inline auto stats_idtable() {49 using namespace Stats::Counters;50 static auto group = build<CounterGroup>("IdTable");51 static struct {52 SimpleCounter * find;53 AverageCounter<double> * size;54 AverageCounter<double> * key;55 } ret = {56 .find = build<SimpleCounter>("Find calls", group),57 .size = build<AverageCounter<double>>("Average Size", group),58 .key = build<AverageCounter<double>>("Average Key Size", group),59 };60 return ret;61 }62 63 static inline auto stats_indexers() {64 using namespace Stats::Counters;65 static auto group = build<CounterGroup>("Indexers");66 static struct {67 SimpleCounter * count;68 AverageCounter<double> * size;69 AverageCounter<double> * depth_a;70 MaxCounter<size_t> * depth_m;71 } ret = {72 .count = build<SimpleCounter>("Count", group),73 .size = build<AverageCounter<double>>("Average Size", group),74 .depth_a = build<AverageCounter<double>>("Average Depth", group),75 .depth_m = build<MaxCounter<size_t>>("Max Depth", group),76 };77 return ret;78 }79 }80 81 43 std::ostream & operator<<( std::ostream & out, const Indexer::IdData & data ) { 82 44 return out << "(" << data.id << "," << data.baseExpr << ")"; … … 235 197 } 236 198 237 Indexer::Indexer() : tables( 0 ), scope( 0 ) { 238 (*stats_indexers().count)++; 239 } 240 241 Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) { 242 (*stats_indexers().count)++; 243 } 199 Indexer::Indexer() : tables( 0 ), scope( 0 ) {} 200 201 Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) {} 244 202 245 203 Indexer::Indexer( Indexer &&that ) : doDebug( that.doDebug ), tables( that.tables ), scope( that.scope ) { … … 248 206 249 207 Indexer::~Indexer() { 250 if(tables) {251 stats_indexers().size->push( tables->idTable.size() );252 size_t depth = 1;253 for( auto crnt = tables->base.tables; crnt; crnt = crnt->base.tables ) {254 ++depth;255 }256 stats_indexers().depth_a->push( depth );257 stats_indexers().depth_m->push( depth );258 }259 208 deleteRef( tables ); 260 209 } … … 288 237 while ( searchTables ) { 289 238 290 (*stats_idtable().find)++;291 stats_idtable().key->push( id.size() );292 stats_idtable().size->push( searchTables->idTable.size() );293 239 IdTable::const_iterator decls = searchTables->idTable.find( id ); 294 240 if ( decls != searchTables->idTable.end() ) { … … 367 313 if ( tables->scope < scope ) return nullptr; 368 314 369 (*stats_idtable().find)++;370 stats_idtable().key->push( id.size() );371 stats_idtable().size->push( tables->idTable.size() );372 315 IdTable::const_iterator decls = tables->idTable.find( id ); 373 316 if ( decls != tables->idTable.end() ) { … … 388 331 if ( tables->scope < scope ) return false; 389 332 390 (*stats_idtable().find)++;391 stats_idtable().key->push( id.size() );392 stats_idtable().size->push( tables->idTable.size() );393 333 IdTable::const_iterator decls = tables->idTable.find( id ); 394 334 if ( decls != tables->idTable.end() ) { … … 407 347 if ( tables->scope < scope ) return false; 408 348 409 (*stats_idtable().find)++;410 stats_idtable().key->push( id.size() );411 stats_idtable().size->push( tables->idTable.size() );412 349 IdTable::const_iterator decls = tables->idTable.find( id ); 413 350 if ( decls != tables->idTable.end() ) {
Note:
See TracChangeset
for help on using the changeset viewer.