Skip to content

Commit

Permalink
port to the new log api
Browse files Browse the repository at this point in the history
This involves:

* creating a `Logger` object (always)
* using `logger.log(|| ...)` instead of a macro
    * if logs are not compiled in, this should be optimized away
* the logger tracks the number of active threads in various states etc
* some log event names were "normalized" to be more consistent
  • Loading branch information
nikomatsakis committed Aug 1, 2020
1 parent 5d5301b commit bb59970
Show file tree
Hide file tree
Showing 6 changed files with 466 additions and 131 deletions.
1 change: 1 addition & 0 deletions rayon-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ categories = ["concurrency"]
[dependencies]
num_cpus = "1.2"
lazy_static = "1"
crossbeam-channel = "0.3.9"
crossbeam-deque = "0.7.2"
crossbeam-queue = "0.2"
crossbeam-utils = "0.7"
Expand Down
11 changes: 2 additions & 9 deletions rayon-core/src/join/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ where
}

registry::in_worker(|worker_thread, injected| unsafe {
log!(Join {
worker: worker_thread.index()
});

// Create virtual wrapper for task b; this all has to be
// done here so that the stack frame can keep it all live
// long enough.
Expand All @@ -160,23 +156,20 @@ where
// Found it! Let's run it.
//
// Note that this could panic, but it's ok if we unwind here.
log!(PoppedRhs {
worker_thread.log(|| JobPoppedRhs {
worker: worker_thread.index()
});
let result_b = job_b.run_inline(injected);
return (result_a, result_b);
} else {
log!(PoppedJob {
worker_thread.log(|| JobPopped {
worker: worker_thread.index()
});
worker_thread.execute(job);
}
} else {
// Local deque is empty. Time to steal from other
// threads.
log!(LostJob {
worker: worker_thread.index()
});
worker_thread.wait_until(&job_b.latch);
debug_assert!(job_b.latch.probe());
break;
Expand Down

0 comments on commit bb59970

Please sign in to comment.