- Timestamp:
- Aug 13, 2014, 4:34:50 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/reconfiguration/platforms/tsar_generic_iob/top.cpp
r760 r766 1397 1397 // simulation loop 1398 1398 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) 1427 1405 { 1428 1406 // stats display 1429 if( 1407 if((n % stats_period) == 0) 1430 1408 { 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 } 1441 1420 1442 1421 gettimeofday(&t1, NULL); … … 1565 1544 } 1566 1545 1567 sc_start(sc_core::sc_time( 1, SC_NS));1546 sc_start(sc_core::sc_time(simul_period, SC_NS)); 1568 1547 } 1569 1548 return EXIT_SUCCESS;
Note: See TracChangeset
for help on using the changeset viewer.