Ignore:
Timestamp:
Sep 6, 2016, 4:00:48 PM (8 years ago)
Author:
alain
Message:

Improve the debug features regarding frozen cycles.

Location:
trunk/modules/vci_cc_vcache_wrapper/caba/source
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/vci_cc_vcache_wrapper/caba/source/include/vci_cc_vcache_wrapper.h

    r740 r1047  
    711711    uint32_t m_cpt_fsm_cc_send    [64];
    712712
    713     uint32_t m_cpt_stop_simulation;             // used to stop simulation if frozen
     713    // frozen cycles counters
     714    uint32_t m_cpt_stop_simulation;             // number of cycles continuously frozen
     715    uint32_t m_cpt_frozen_events;               // number of pathological transactions   
     716    uint32_t m_cpt_frozen_cost;             // cost of pathological transactions
     717
     718    // debug counters
    714719    bool     m_monitor_ok;                      // used to debug cache output 
    715720    uint32_t m_monitor_base;               
    716     uint32_t m_monitor_length;             
     721    uint32_t m_monitor_length;
    717722
    718723protected:
     
    747752
    748753    void print_cpi();
    749     void print_stats();
    750     void clear_stats();
     754    void print_frozen_stats();
    751755    void print_trace(size_t mode = 0);
    752756    void cache_monitor(paddr_t addr);
  • trunk/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp

    r1041 r1047  
    591591    }
    592592}
     593
     594/////////////////////////////////
     595tmpl(void)::print_frozen_stats()
     596/////////////////////////////////
     597{
     598    if ( m_cpt_frozen_events )
     599    {
     600        float run_cycles = (float)(m_cpt_total_cycles - m_cpt_frz_cycles);
     601        std::cout << name()
     602                  << " : FROZEN EVENTS = " << m_cpt_frozen_events
     603                  << " / AVERAGE LENGTH = " << m_cpt_frozen_cost/(m_cpt_frozen_events*1000)
     604                  << " Kcycles / CPI = " << (float)m_cpt_total_cycles/run_cycles << std::endl;
     605    }
     606}
     607
    593608
    594609/*
     
    853868        m_cpt_total_cycles      = 0;
    854869        m_cpt_stop_simulation   = 0;
     870        m_cpt_frozen_events     = 0;
     871        m_cpt_frozen_cost       = 0;
    855872
    856873        m_cpt_data_miss         = 0;
     
    865882        m_cost_ins_miss_frz     = 0;
    866883
    867         m_cpt_imiss_transaction = 0;
    868         m_cpt_dmiss_transaction = 0;
    869         m_cpt_unc_transaction   = 0;
    870         m_cpt_write_transaction = 0;
    871         m_cpt_icache_unc_transaction = 0;
     884        m_cpt_imiss_transaction       = 0;
     885        m_cpt_dmiss_transaction       = 0;
     886        m_cpt_unc_transaction         = 0;
     887        m_cpt_write_transaction       = 0;
     888        m_cpt_icache_unc_transaction  = 0;
    872889
    873890        m_cost_imiss_transaction      = 0;
     
    50805097    } // end switch r_dcache_fsm
    50815098
    5082     ///////////////// wbuf update ///////////////////////////////////////////////////////
     5099    ///////////////// wbuf update //////////////////////////////////////////////////////////
    50835100    r_wbuf.update();
    50845101
    5085     ///////////////// llsc update ///////////////////////////////////////////////////////
     5102    ///////////////// llsc update //////////////////////////////////////////////////////////
    50865103    if (r_dcache_llsc_valid.read()) r_dcache_llsc_count = r_dcache_llsc_count.read() - 1;
    50875104    if (r_dcache_llsc_count.read() == 1) r_dcache_llsc_valid = false;
    50885105
    5089     //////////////// test processor frozen //////////////////////////////////////////////
    5090     // The simulation exit if the number of consecutive frozen cycles
    5091     // is larger than the m_max_frozen_cycles (constructor parameter)
    5092     if ((m_ireq.valid and not m_irsp.valid) or (m_dreq.valid and not m_drsp.valid))
    5093     {
    5094         m_cpt_frz_cycles++;      // used for instrumentation
    5095         m_cpt_stop_simulation++; // used for debug
    5096         if (m_cpt_stop_simulation > m_max_frozen_cycles)
     5106    //////////////// test processor frozen /////////////////////////////////////////////////
     5107    // 1) The m_cpt_frz_cycles counter defining the total number of cache related frozen
     5108    //    cycles is incremented.
     5109    // 2) If the processor is continuously frozen for more than (m_max_frozen_cycles / 20),
     5110    //    a warning is issued, and the two m_cpt_frozen_events & m_cpt_frozen_cost counters
     5111    //    are incremented to evaluate the frequency and cost of pahological transactions.
     5112    // 3) If the processor is continuously frozen for more than (m_max_frozen_cycles),
     5113    //    the simulation is stopped, with an error message.
     5114    ////////////////////////////////////////////////////////////////////////////////////////
     5115
     5116    if ((m_ireq.valid and not m_irsp.valid) or (m_dreq.valid and not m_drsp.valid))   // frozen
     5117    {
     5118        m_cpt_frz_cycles++;         // total number of frozen cycles
     5119        m_cpt_stop_simulation++;    // number of continuously frozen cycles
     5120        if ( m_cpt_stop_simulation > m_max_frozen_cycles )
    50975121        {
    50985122            std::cout << std::dec << "ERROR in CC_VCACHE_WRAPPER " << name() << std::endl
     
    51055129        }
    51065130    }
    5107     else
    5108     {
     5131    else   // processor not frozen
     5132    {
     5133        if ( m_cpt_stop_simulation > (m_max_frozen_cycles/20) )
     5134        {
     5135            m_cpt_frozen_events++;
     5136            m_cpt_frozen_cost += m_cpt_stop_simulation;
     5137            std::cout << std::dec << "WARNING : Proc " << name()
     5138                      << " frozen from cycle " << (m_cpt_total_cycles - m_cpt_stop_simulation)
     5139                      << " for " << (m_cpt_stop_simulation / 1000) << " Kcyles" << std::endl;
     5140        }
    51095141        m_cpt_stop_simulation = 0;
    51105142    }
Note: See TracChangeset for help on using the changeset viewer.