Ignore:
Timestamp:
Aug 13, 2014, 4:34:50 PM (8 years ago)
Author:
cfuguet
Message:

reconfiguration: tsar_generic_iob sc_start() calls optimization

  • sc_start() continue during 'simul_period' cycles
  • 'simul_period' is defined as the debug_period if debug activated or 'stats_period' otherwise
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/reconfiguration/platforms/tsar_generic_iob/top.cpp

    r760 r766  
    13971397   // simulation loop
    13981398   struct timeval t1,t2;
    1399    const size_t stats_period = 100000; // cycles
    1400 
    1401    if (ncycles == UINT_MAX)
    1402    {
    1403       int n = 0;
    1404       while(1)
    1405       {
    1406          gettimeofday(&t1, NULL);
    1407          sc_start(sc_core::sc_time(stats_period, SC_NS));
    1408          gettimeofday(&t2, NULL);
    1409 
    1410          n += stats_period;
    1411 
    1412          uint64_t ms1 = (uint64_t) t1.tv_sec  * 1000ULL +
    1413             (uint64_t) t1.tv_usec / 1000;
    1414          uint64_t ms2 = (uint64_t) t2.tv_sec  * 1000ULL +
    1415             (uint64_t) t2.tv_usec / 1000;
    1416          std::cerr << "### cycle = " << n
    1417             << " / frequency = "
    1418             << (double) stats_period / (double) (ms2 - ms1) << "Khz"
    1419             << std::endl;
    1420       }
    1421 
    1422       return EXIT_SUCCESS;
    1423    }
    1424 
    1425    gettimeofday(&t1, NULL);
    1426    for (size_t n = 1; n < ncycles; n++)
     1399
     1400   // cycles between stats
     1401   const size_t stats_period = 100000;
     1402   const size_t simul_period = debug_ok ? debug_period : stats_period;
     1403
     1404   for (size_t n = 0; n < ncycles; n += simul_period)
    14271405   {
    14281406      // stats display
    1429       if( (n % stats_period) == 0)
     1407      if((n % stats_period) == 0)
    14301408      {
    1431          gettimeofday(&t2, NULL);
    1432 
    1433          uint64_t ms1 = (uint64_t) t1.tv_sec  * 1000ULL +
    1434             (uint64_t) t1.tv_usec / 1000;
    1435          uint64_t ms2 = (uint64_t) t2.tv_sec  * 1000ULL +
    1436             (uint64_t) t2.tv_usec / 1000;
    1437          std::cerr << "### cycle = " << n
    1438             << " / frequency = "
    1439             << (double) stats_period / (double) (ms2 - ms1) << "Khz"
    1440             << std::endl;
     1409         if (n > 0)
     1410         {
     1411            gettimeofday(&t2, NULL);
     1412
     1413            uint64_t ms1 = (uint64_t) t1.tv_sec  * 1000ULL +
     1414               (uint64_t) t1.tv_usec / 1000;
     1415            uint64_t ms2 = (uint64_t) t2.tv_sec  * 1000ULL +
     1416               (uint64_t) t2.tv_usec / 1000;
     1417            std::cerr << "### cycle = " << n << " / frequency (Khz) = "
     1418               << (double) stats_period / (double) (ms2 - ms1) << std::endl;
     1419         }
    14411420
    14421421         gettimeofday(&t1, NULL);
     
    15651544      }
    15661545
    1567       sc_start(sc_core::sc_time(1, SC_NS));
     1546      sc_start(sc_core::sc_time(simul_period, SC_NS));
    15681547   }
    15691548   return EXIT_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.