Changeset 145


Ignore:
Timestamp:
Apr 1, 2011, 12:20:28 PM (13 years ago)
Author:
choichil
Message:

Adding function to get Latencies and a period for broadcast calculated with ramdomize

Location:
trunk/modules/vci_synthetic_initator/caba/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/vci_synthetic_initator/caba/sources/include/vci_synthetic_initiator.h

    r135 r145  
    117117      void printStats();
    118118
     119      double getLatencySingle();
     120
     121      double getLatencyBC();
     122
    119123      void print_trace();
    120124
  • trunk/modules/vci_synthetic_initator/caba/sources/src/vci_synthetic_initiator.cpp

    r135 r145  
    3535
    3636//#define DETERMINISTIC
     37#define RANDOM_PERIOD
    3738
    3839namespace soclib { namespace caba {
     
    133134  }
    134135
    135  
     136  //////////////////////////////////
     137  tmpl(double)::getLatencySingle()
     138  //////////////////////////////////
     139  {
     140        if (m_rho)
     141          return (double)(r_latency_single.read())/(double)(r_nb_single.read());
     142        else
     143          return 0;
     144
     145  }
     146
     147  //////////////////////////////////
     148  tmpl(double)::getLatencyBC()
     149  //////////////////////////////////
     150  {
     151        if(m_bc_period)
     152          return ((double)r_latency_bc.read()/(double)r_nb_bc.read());
     153        else
     154          return 0;
     155
     156  }
     157
    136158  //////////////////////////////////
    137159  tmpl(void)::print_trace()
     
    151173                  << " Adresse to send : " << std::hex << r_cmd_address.read()
    152174                  << " Number of broadcast to receive : " << std::dec << r_bc_nrsp.read()
    153                   << " Number of packets sent : " << std::dec << r_nb_single.read() << " " << r_cmd_trdid.read() << std::endl;
     175                  << " Number of packets sent : " << std::dec << r_nb_single.read() << " " << r_cmd_trdid.read()
     176                  << " Cycles to the next BC : " << r_cpt_period.read() << std::endl;
    154177        for(int i = 0; i < (1<<vci_param::T) ; i++){
    155178          std::cout << "ID : " << i << " " << (uint64_t)(r_pending_date[i].read()) << std::endl;
     
    322345    //  traffic regulator
    323346    ////////////////////////
     347#ifdef RANDOM_PERIOD
     348    if ( m_bc_period && (r_cpt_period.read() == 0) )
     349#else
    324350    if ( m_bc_period && (r_cpt_period.read() > m_bc_period) )
     351#endif
    325352    {
    326353      fifo_put = true ;
     
    329356      {
    330357        r_nb_bc = r_nb_bc.read() + 1;
     358#ifdef RANDOM_PERIOD
     359        r_cpt_period = (uint64_t) (rand()%(2*m_bc_period));
     360#else
    331361        r_cpt_period = 0;
     362#endif
    332363      }
    333364    }
     
    339370    }
    340371
     372#ifdef RANDOM_PERIOD
     373    if ( m_bc_period && (r_cpt_period.read() == 0) && r_date_fifo.wok() )
     374        r_cpt_period = (uint64_t) (rand()%(2*m_bc_period));
     375    else
     376      r_cpt_period = r_cpt_period.read() - 1;
     377#else
    341378    if ( m_bc_period && (r_cpt_period.read() > m_bc_period) && r_date_fifo.wok() )
    342379      r_cpt_period = 0;
    343380    else
    344381      r_cpt_period = r_cpt_period.read() + 1;
     382#endif
    345383
    346384    ////////////////////////
Note: See TracChangeset for help on using the changeset viewer.