asdfkkkkkkkkk
This commit is contained in:
parent
edf25e407f
commit
f8aa8d9615
|
@ -48,4 +48,4 @@ cfg-if = "1.0.0"
|
||||||
async-std = "1.13.0"
|
async-std = "1.13.0"
|
||||||
tracing-test = "0.2.5"
|
tracing-test = "0.2.5"
|
||||||
tracing-tracy = "0.11.4"
|
tracing-tracy = "0.11.4"
|
||||||
distaff = {path = "distaff"}
|
distaff = {path = "distaff", features = ["tracing"]}
|
||||||
|
|
|
@ -191,11 +191,7 @@ fn join_distaff(b: &mut Bencher) {
|
||||||
let pool = ThreadPool::new();
|
let pool = ThreadPool::new();
|
||||||
let tree = tree::Tree::new(TREE_SIZE, 1u32);
|
let tree = tree::Tree::new(TREE_SIZE, 1u32);
|
||||||
|
|
||||||
fn sum<'scope, 'env>(
|
fn sum<'scope, 'env>(tree: &tree::Tree<u32>, node: usize, scope: Scope<'scope, 'env>) -> u32 {
|
||||||
tree: &tree::Tree<u32>,
|
|
||||||
node: usize,
|
|
||||||
scope: &'scope Scope<'scope, 'env>,
|
|
||||||
) -> u32 {
|
|
||||||
let node = tree.get(node);
|
let node = tree.get(node);
|
||||||
let (l, r) = scope.join(
|
let (l, r) = scope.join(
|
||||||
|s| node.left.map(|node| sum(tree, node, s)).unwrap_or_default(),
|
|s| node.left.map(|node| sum(tree, node, s)).unwrap_or_default(),
|
||||||
|
@ -215,7 +211,7 @@ fn join_distaff(b: &mut Bencher) {
|
||||||
assert_ne!(sum, 0);
|
assert_ne!(sum, 0);
|
||||||
sum
|
sum
|
||||||
});
|
});
|
||||||
eprintln!("{sum}");
|
std::hint::black_box(sum);
|
||||||
});
|
});
|
||||||
eprintln!("Done with distaff join");
|
eprintln!("Done with distaff join");
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ debug = true
|
||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["metrics"]
|
default = []
|
||||||
tracing = ["dep:tracing"]
|
tracing = ["dep:tracing"]
|
||||||
std = []
|
std = []
|
||||||
metrics = []
|
metrics = []
|
||||||
|
|
|
@ -136,6 +136,9 @@ impl<T: Send> Receiver<T> {
|
||||||
.is_ok()
|
.is_ok()
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
} else {
|
||||||
|
// The state was changed to `State::Ready` by the `Sender`, so we can return.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(state) if state == State::Ready as u8 => {
|
Err(state) if state == State::Ready as u8 => {
|
||||||
|
@ -183,13 +186,13 @@ impl<T: Send> Receiver<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn take(&self) -> thread::Result<T> {
|
unsafe fn take(&self) -> thread::Result<T> {
|
||||||
let result = unsafe { (*self.0.val.get()).take().map(|b| *b).unwrap() };
|
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
self.0.state.swap(State::Taken as u8, Ordering::Release),
|
self.0.state.swap(State::Taken as u8, Ordering::Acquire),
|
||||||
State::Ready as u8
|
State::Ready as u8
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let result = unsafe { (*self.0.val.get()).take().map(|b| *b).unwrap() };
|
||||||
|
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@ impl HeartbeatList {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn notify_nth(&self, n: usize) {
|
pub fn notify_nth(&self, n: usize) {
|
||||||
|
#[cfg(feature = "tracing")]
|
||||||
|
tracing::trace!("notifying worker-{}", n);
|
||||||
self.inner.lock().notify_nth(n);
|
self.inner.lock().notify_nth(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ impl WorkerThread {
|
||||||
|
|
||||||
/// This function must be called from a worker thread.
|
/// This function must be called from a worker thread.
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
#[cfg_attr(feature = "tracing", tracing::instrument(level = "trace", skip_all))]
|
||||||
pub(crate) fn join_heartbeat2_every<A, B, RA, RB, const TIMES: usize>(
|
pub(crate) fn join_heartbeat2_every<A, B, RA, RB, const TIMES: usize>(
|
||||||
&self,
|
&self,
|
||||||
a: A,
|
a: A,
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
box_as_ptr,
|
box_as_ptr,
|
||||||
box_vec_non_null,
|
box_vec_non_null,
|
||||||
strict_provenance_atomic_ptr,
|
strict_provenance_atomic_ptr,
|
||||||
|
btree_extract_if,
|
||||||
likely_unlikely,
|
likely_unlikely,
|
||||||
let_chains
|
let_chains
|
||||||
)]
|
)]
|
||||||
|
|
|
@ -66,7 +66,7 @@ fn join_distaff(tree_size: usize) {
|
||||||
|
|
||||||
let tree = Tree::new(tree_size, 1);
|
let tree = Tree::new(tree_size, 1);
|
||||||
|
|
||||||
fn sum<'scope, 'env>(tree: &Tree<u32>, node: usize, scope: &'scope Scope<'scope, 'env>) -> u32 {
|
fn sum<'scope, 'env>(tree: &Tree<u32>, node: usize, scope: Scope<'scope, 'env>) -> u32 {
|
||||||
let node = tree.get(node);
|
let node = tree.get(node);
|
||||||
let (l, r) = scope.join(
|
let (l, r) = scope.join(
|
||||||
|s| node.left.map(|node| sum(tree, node, s)).unwrap_or_default(),
|
|s| node.left.map(|node| sum(tree, node, s)).unwrap_or_default(),
|
||||||
|
@ -134,16 +134,15 @@ fn join_rayon(tree_size: usize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tracing_subscriber::fmt::init();
|
//tracing_subscriber::fmt::init();
|
||||||
// use tracing_subscriber::layer::SubscriberExt;
|
use tracing_subscriber::layer::SubscriberExt;
|
||||||
// tracing::subscriber::set_global_default(
|
tracing::subscriber::set_global_default(
|
||||||
// tracing_subscriber::registry()
|
tracing_subscriber::registry().with(tracing_tracy::TracyLayer::default()),
|
||||||
// .with(tracing_tracy::TracyLayer::default()),
|
)
|
||||||
// )
|
.expect("Failed to set global default subscriber");
|
||||||
// .expect("Failed to set global default subscriber");
|
|
||||||
|
|
||||||
// eprintln!("Press Enter to start profiling...");
|
eprintln!("Press Enter to start profiling...");
|
||||||
// std::io::stdin().read_line(&mut String::new()).unwrap();
|
std::io::stdin().read_line(&mut String::new()).unwrap();
|
||||||
|
|
||||||
let size = std::env::args()
|
let size = std::env::args()
|
||||||
.nth(2)
|
.nth(2)
|
||||||
|
@ -166,7 +165,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eprintln!("Done!");
|
eprintln!("Done!");
|
||||||
// // wait for user input before exiting
|
// // wait for user input before exiting
|
||||||
// std::io::stdin().read_line(&mut String::new()).unwrap();
|
// std::io::stdin().read_line(&mut String::new()).unwrap();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue