From 34149bec142ba633f1e1b26a528ef6d77a05a3f6 Mon Sep 17 00:00:00 2001 From: Wilson Fung Date: Thu, 20 Jan 2011 18:59:45 -0800 Subject: Integration change. Bug fixes from AMD-CMU trace gen branch. [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 8389] --- src/stream_manager.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/stream_manager.cc') diff --git a/src/stream_manager.cc b/src/stream_manager.cc index 54e2ee7..b9a83d8 100644 --- a/src/stream_manager.cc +++ b/src/stream_manager.cc @@ -370,8 +370,16 @@ void stream_manager::push( stream_operation op ) print_impl(stdout); pthread_mutex_unlock(&m_lock); if( m_cuda_launch_blocking || stream == NULL ) { - while( !empty() ) - ; + unsigned int wait_amount = 100; + unsigned int wait_cap = 100000; // 100ms + while( !empty() ) { + // sleep to prevent CPU hog by empty spin + // sleep time increased exponentially ensure fast response when needed + usleep(wait_amount); + wait_amount *= 2; + if (wait_amount > wait_cap) + wait_amount = wait_cap; + } } } -- cgit v1.3