- Timestamp:
- 11/04/07 09:32:40 (13 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/ppalmers-streaming/src/libstreaming/StreamProcessorManager.cpp
r707 r708 30 30 #include <assert.h> 31 31 32 #define CYCLES_TO_SLEEP_AFTER_RUN_SIGNAL 533 34 32 #define RUNNING_TIMEOUT_MSEC 4000 35 33 #define PREPARE_TIMEOUT_MSEC 4000 36 34 #define ENABLE_TIMEOUT_MSEC 4000 37 38 //#define ENABLE_DELAY_CYCLES 10039 #define ENABLE_DELAY_CYCLES 100040 35 41 36 namespace Streaming { … … 436 431 debugOutput( DEBUG_LEVEL_VERBOSE, "Enabling StreamProcessors...\n"); 437 432 438 uint64_t now=m_SyncSource->getTimeNow(); // fixme: should be in usecs, not ticks439 440 433 // FIXME: this should not be in cycles, but in 'time' 441 434 // FIXME: remove the timestamp 442 unsigned int enable_at=TICKS_TO_CYCLES(now)+ENABLE_DELAY_CYCLES; 443 if (enable_at > 8000) enable_at -= 8000; 444 445 if (!enableStreamProcessors(enable_at)) { 435 if (!enableStreamProcessors(0)) { 446 436 debugFatal("Could not enable StreamProcessors...\n"); 447 437 return false; … … 449 439 450 440 debugOutput( DEBUG_LEVEL_VERBOSE, "Running dry for a while...\n"); 441 #define MAX_DRYRUN_CYCLES 20 442 #define MIN_SUCCESSFUL_DRYRUN_CYCLES 4 451 443 // run some cycles 'dry' such that everything can stabilize 452 int nb_dryrun_cycles=10; 453 bool no_xrun; 454 while(nb_dryrun_cycles--) { 444 int nb_dryrun_cycles_left = MAX_DRYRUN_CYCLES; 445 int nb_succesful_cycles = 0; 446 while(nb_dryrun_cycles_left > 0 && 447 nb_succesful_cycles < MIN_SUCCESSFUL_DRYRUN_CYCLES ) { 448 455 449 waitForPeriod(); 456 m_TransmitProcessors.at(0)->m_PacketStat.dumpInfo(); 457 no_xrun = dryRun(); // dry run both receive and xmit458 459 if (!no_xrun){450 451 if (dryRun()) { 452 nb_succesful_cycles++; 453 } else { 460 454 debugOutput( DEBUG_LEVEL_VERBOSE, " This dry-run was not xrun free...\n" ); 461 455 resetXrunCounters(); 456 nb_succesful_cycles = 0; 462 457 // FIXME: xruns can screw up the framecounter accounting. do something more sane here 463 458 } 464 } 459 nb_dryrun_cycles_left--; 460 } 461 462 if(nb_dryrun_cycles_left == 0) { 463 debugOutput( DEBUG_LEVEL_VERBOSE, " max # dry-run cycles achieved without steady-state...\n" ); 464 return false; 465 } 466 debugOutput( DEBUG_LEVEL_VERBOSE, " dry-run resulted in steady-state...\n" ); 465 467 466 468 // now we should clear the xrun flags