Skip to content

Commit 7066517

Browse files
Revert breaking interface changes for private
1 parent b094fae commit 7066517

3 files changed

Lines changed: 18 additions & 12 deletions

File tree

crates/core/src/startup.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,6 @@ impl Cores {
317317
let tokio = TokioCores {
318318
workers: Some(tokio_workers),
319319
#[cfg(target_os = "linux")]
320-
workers_shared: None,
321-
#[cfg(target_os = "linux")]
322320
blocking: remaining,
323321
};
324322

@@ -352,7 +350,6 @@ impl Cores {
352350
#[cfg(target_os = "linux")]
353351
let tokio = TokioCores {
354352
workers: None,
355-
workers_shared: Some((shared.len(), shared_cpuset)),
356353
blocking: Some(shared_cpuset),
357354
};
358355

@@ -381,7 +378,7 @@ impl Cores {
381378
}
382379

383380
#[cfg(target_os = "linux")]
384-
fn get_core_ids() -> Option<Vec<CoreId>> {
381+
pub fn get_core_ids() -> Option<Vec<CoreId>> {
385382
if cfg!(feature = "no-core-pinning") {
386383
return None;
387384
}
@@ -422,11 +419,17 @@ fn cores_to_cpuset(cores: &[CoreId]) -> Option<nix::sched::CpuSet> {
422419
})
423420
}
424421

422+
#[cfg(target_os = "linux")]
423+
fn cpuset_cardinality(cpuset: &nix::sched::CpuSet) -> usize {
424+
(0..nix::sched::CpuSet::count())
425+
.filter_map(|cpu| cpuset.is_set(cpu).ok())
426+
.filter(|is_set| *is_set)
427+
.count()
428+
}
429+
425430
#[derive(Default)]
426431
pub struct TokioCores {
427432
pub workers: Option<Vec<CoreId>>,
428-
#[cfg(target_os = "linux")]
429-
pub workers_shared: Option<(usize, nix::sched::CpuSet)>,
430433
// For blocking threads, we don't want to limit them to a specific number
431434
// and pin them to their own cores - they're supposed to run concurrently
432435
// with each other. However, `core_affinity` doesn't support affinity masks,
@@ -463,8 +466,8 @@ impl TokioCores {
463466
});
464467
} else {
465468
#[cfg(target_os = "linux")]
466-
if let Some((threads, cpuset)) = self.workers_shared {
467-
builder.worker_threads(threads);
469+
if let Some(cpuset) = self.blocking {
470+
builder.worker_threads(cpuset_cardinality(&cpuset));
468471
builder.on_thread_start(move || {
469472
let this = nix::unistd::Pid::from_raw(0);
470473
let _ = nix::sched::sched_setaffinity(this, &cpuset);
@@ -588,7 +591,10 @@ mod tests {
588591
#[cfg(target_os = "linux")]
589592
{
590593
assert!(split.tokio.workers.is_none());
591-
assert_eq!(split.tokio.workers_shared.as_ref().unwrap().0, 20);
594+
assert_eq!(
595+
cpuset_cardinality(split.tokio.blocking.as_ref().unwrap()),
596+
20
597+
);
592598
assert!(split.rayon.dedicated.is_none());
593599
assert_eq!(split.rayon.shared.as_ref().unwrap().0, 20);
594600
}

tools/tpcc-runner/src/coordinator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::path::Path;
99
use std::sync::Arc;
1010

1111
use crate::config::CoordinatorConfig;
12-
use crate::metrics_module_bindings::{register_completed_order, reset};
12+
use crate::metrics_module_bindings::reset_reducer::reset;
1313
use crate::metrics_module_client::connect_metrics_module;
1414
use crate::protocol::{
1515
DriverAssignment, RegisterDriverRequest, RegisterDriverResponse, RunSchedule, ScheduleResponse,
@@ -138,7 +138,7 @@ fn maybe_create_schedule(inner: &mut CoordinatorState) {
138138
let measure_end_ms = measure_start_ms + (inner.config.measure_secs * 1_000);
139139

140140
let metrics_client = connect_metrics_module(&inner.config.connection).unwrap();
141-
metrics_client
141+
let _ = metrics_client
142142
.reducers
143143
.reset(inner.config.warmup_secs * 1000, measure_start_ms, measure_end_ms);
144144

tools/tpcc-runner/src/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ fn run_terminal(runtime: TerminalRuntime) -> Result<()> {
180180
// Some metrics depend on knowing all completed orders, even outside the
181181
// measurement window
182182
if record.kind == TransactionKind::NewOrder && record.success {
183-
metrics_client.reducers.register_completed_order();
183+
let _ = metrics_client.reducers.register_completed_order();
184184
}
185185

186186
if record.timestamp_ms >= schedule.measure_start_ms && record.timestamp_ms < schedule.measure_end_ms {

0 commit comments

Comments
 (0)