Changeset 675716e for src/Common


Ignore:
Timestamp:
Mar 1, 2019, 3:10:09 PM (6 years ago)
Author:
tdelisle <tdelisle@…>
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:
1cb7fab2
Parents:
8e70823
Message:

Instrumented PassVisitor? to print average/max depth

Location:
src/Common
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.h

    r8e70823 r675716e  
    55#include <stack>
    66
     7#include "Common/Stats.h"
    78#include "Common/utility.h"
    89
     
    426427};
    427428
     429#include "Common/Stats.h"
     430
     431extern struct PassVisitorStats {
     432        size_t depth = 0;
     433        Stats::Counters::MaxCounter<double> * max = nullptr;
     434        Stats::Counters::AverageCounter<double> * avg = nullptr;
     435} pass_visitor_stats;
     436
    428437#include "SynTree/TypeSubstitution.h"
    429438#include "PassVisitor.impl.h"
  • src/Common/PassVisitor.impl.h

    r8e70823 r675716e  
    6767        SemanticErrorException errors;
    6868
     69        pass_visitor_stats.depth++;
     70        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     71        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    6972        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
     73
     74
    7075                // splice in new declarations after previous decl
    7176                if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
     
    8388                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
    8489        }
     90        pass_visitor_stats.depth--;
    8591        if ( ! errors.isEmpty() ) {
    8692                throw errors;
     
    94100        SemanticErrorException errors;
    95101
     102        pass_visitor_stats.depth++;
     103        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     104        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    96105        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    97106                // splice in new declarations after previous decl
     
    109118                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
    110119        }
     120        pass_visitor_stats.depth--;
    111121        if ( ! errors.isEmpty() ) {
    112122                throw errors;
     
    126136        if ( ! visitor.get_visit_children() ) return;
    127137        SemanticErrorException errors;
     138
     139        pass_visitor_stats.depth++;
     140        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     141        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    128142        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    129143                try {
     
    135149                }
    136150        }
     151        pass_visitor_stats.depth--;
    137152        if ( ! errors.isEmpty() ) {
    138153                throw errors;
     
    153168        if ( ! mutator.get_visit_children() ) return;
    154169        SemanticErrorException errors;
     170
     171        pass_visitor_stats.depth++;
     172        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     173        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    155174        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    156175                try {
     
    163182                } // try
    164183        } // for
     184        pass_visitor_stats.depth--;
    165185        if ( ! errors.isEmpty() ) {
    166186                throw errors;
     
    185205        DeclList_t* afterDecls  = get_afterDecls();
    186206
     207        pass_visitor_stats.depth++;
     208        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     209        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    187210        for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
    188211
     
    202225                if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); }
    203226        }
     227        pass_visitor_stats.depth--;
    204228
    205229        if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); }
  • src/Common/Stats/Base.h

    r8e70823 r675716e  
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2019 University of Waterloo
     3//
     4// The contents of this file are covered under the licence agreement in the
     5// file "LICENCE" distributed with Cforall.
     6//
     7// Heap.h --
     8//
     9// Author           : Thierry Delisle
     10// Created On       : Fri Mar 03 14:53:53 2019
     11// Last Modified By :
     12// Last Modified On :
     13// Update Count     :
     14//
     15
    116#pragma once
    217
  • src/Common/Stats/Counter.cc

    r8e70823 r675716e  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Heap.h --
     7// Counter.cc --
    88//
    99// Author           : Thierry Delisle
  • src/Common/Stats/Counter.h

    r8e70823 r675716e  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Heap.h --
     7// Counter.h --
    88//
    99// Author           : Thierry Delisle
  • src/Common/module.mk

    r8e70823 r675716e  
    1717SRC_COMMON = \
    1818      Common/Assert.cc \
     19      Common/Eval.cc \
     20      Common/PassVisitor.cc \
     21      Common/SemanticError.cc \
    1922      Common/Stats/Heap.cc \
    2023      Common/Stats/Counter.cc \
    21       Common/Eval.cc \
    22       Common/SemanticError.cc \
    2324      Common/UniqueName.cc
    2425
Note: See TracChangeset for help on using the changeset viewer.