Changeset 1cb7fab2 for src/SymTab/Indexer.cc
- Timestamp:
- Mar 4, 2019, 2:53:55 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 874ffa4
- Parents:
- 675716e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Indexer.cc
r675716e r1cb7fab2 45 45 // Statistics block 46 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); 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 } 57 79 } 58 80 … … 214 236 215 237 Indexer::Indexer() : tables( 0 ), scope( 0 ) { 216 (* indexers_count)++;238 (*stats_indexers().count)++; 217 239 } 218 240 219 241 Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) { 220 (* indexers_count)++;242 (*stats_indexers().count)++; 221 243 } 222 244 … … 227 249 Indexer::~Indexer() { 228 250 if(tables) { 229 indexers_size->push( tables->idTable.size() );251 stats_indexers().size->push( tables->idTable.size() ); 230 252 size_t depth = 1; 231 253 for( auto crnt = tables->base.tables; crnt; crnt = crnt->base.tables ) { 232 254 ++depth; 233 255 } 234 indexers_depth_a->push( depth );235 indexers_depth_m->push( depth );256 stats_indexers().depth_a->push( depth ); 257 stats_indexers().depth_m->push( depth ); 236 258 } 237 259 deleteRef( tables ); … … 266 288 while ( searchTables ) { 267 289 268 (* idtable_find)++;269 idtable_key->push( id.size() );270 idtable_size->push( searchTables->idTable.size() );290 (*stats_idtable().find)++; 291 stats_idtable().key->push( id.size() ); 292 stats_idtable().size->push( searchTables->idTable.size() ); 271 293 IdTable::const_iterator decls = searchTables->idTable.find( id ); 272 294 if ( decls != searchTables->idTable.end() ) { … … 345 367 if ( tables->scope < scope ) return nullptr; 346 368 347 (* idtable_find)++;348 idtable_key->push( id.size() );349 idtable_size->push( tables->idTable.size() );369 (*stats_idtable().find)++; 370 stats_idtable().key->push( id.size() ); 371 stats_idtable().size->push( tables->idTable.size() ); 350 372 IdTable::const_iterator decls = tables->idTable.find( id ); 351 373 if ( decls != tables->idTable.end() ) { … … 366 388 if ( tables->scope < scope ) return false; 367 389 368 (* idtable_find)++;369 idtable_key->push( id.size() );370 idtable_size->push( tables->idTable.size() );390 (*stats_idtable().find)++; 391 stats_idtable().key->push( id.size() ); 392 stats_idtable().size->push( tables->idTable.size() ); 371 393 IdTable::const_iterator decls = tables->idTable.find( id ); 372 394 if ( decls != tables->idTable.end() ) { … … 385 407 if ( tables->scope < scope ) return false; 386 408 387 (* idtable_find)++;388 idtable_key->push( id.size() );389 idtable_size->push( tables->idTable.size() );409 (*stats_idtable().find)++; 410 stats_idtable().key->push( id.size() ); 411 stats_idtable().size->push( tables->idTable.size() ); 390 412 IdTable::const_iterator decls = tables->idTable.find( id ); 391 413 if ( decls != tables->idTable.end() ) {
Note: See TracChangeset
for help on using the changeset viewer.