summaryrefslogtreecommitdiff
path: root/src/stream_manager.cc
diff options
context:
space:
mode:
authorWilson Fung <[email protected]>2011-01-20 18:59:45 -0800
committerWilson Fung <[email protected]>2011-01-20 18:59:45 -0800
commit34149bec142ba633f1e1b26a528ef6d77a05a3f6 (patch)
tree57d6126ef2f1b294dcba69e8607531748ed7a371 /src/stream_manager.cc
parentf18e4327b836ac66843a1c21cb429cc71bea9714 (diff)
Integration change. Bug fixes from AMD-CMU trace gen branch.
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 8389]
Diffstat (limited to 'src/stream_manager.cc')
-rw-r--r--src/stream_manager.cc12
1 files changed, 10 insertions, 2 deletions
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;
+ }
}
}