Skip to content

Commit

Permalink
Fix conditional compilation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
andyleiserson committed Dec 19, 2024
1 parent 71f9d79 commit 007630e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions ipa-core/benches/oneshot/ipa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use ipa_core::{
ipa::{ipa_in_the_clear, test_oprf_ipa, CappingOrder, IpaSecurityModel},
EventGenerator, EventGeneratorConfig, TestWorld, TestWorldConfig,
},
use_jemalloc,
};
use ipa_step::StepNarrow;
use rand::{random, rngs::StdRng, SeedableRng};
Expand Down Expand Up @@ -159,7 +158,7 @@ async fn run(args: Args) -> Result<(), Error> {

fn main() -> Result<(), Error> {
#[cfg(jemalloc)]
use_jemalloc!();
ipa_core::use_jemalloc!();

#[cfg(feature = "dhat-heap")]
#[global_allocator]
Expand Down
4 changes: 2 additions & 2 deletions ipa-core/src/bin/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use ipa_core::{
ShardHttpTransport,
},
sharding::ShardIndex,
use_jemalloc, AppConfig, AppSetup, NonZeroU32PowerOfTwo,
AppConfig, AppSetup, NonZeroU32PowerOfTwo,
};
use tokio::runtime::Runtime;
use tracing::{error, info};
Expand Down Expand Up @@ -362,7 +362,7 @@ fn new_query_runtime(logging_handle: &LoggingHandle) -> Runtime {
#[tokio::main(flavor = "current_thread")]
pub async fn main() {
#[cfg(jemalloc)]
use_jemalloc!();
ipa_core::use_jemalloc!();

#[cfg(feature = "dhat-heap")]
#[global_allocator]
Expand Down
6 changes: 6 additions & 0 deletions ipa-core/src/telemetry/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ pub mod jemalloc {
static CONTROLS: RwLock<Option<JemallocControls>> = RwLock::new(None);

/// Activates periodic memory usage reporting during `seq_join`.
///
/// # Panics
/// If `RwLock` is poisoned.
pub fn activate() {
let mut controls = CONTROLS.write().unwrap();

Expand Down Expand Up @@ -59,6 +62,9 @@ pub mod jemalloc {
/// As `count` increases, so does the report interval. This results in
/// a tolerable amount of log messages for loops with many iterations,
/// while still providing some reporting for shorter loops.
///
/// # Panics
/// If `RwLock` is poisoned.
pub fn periodic_memory_report(count: usize) {
let controls_opt = CONTROLS.read().unwrap();
if let Some(controls) = controls_opt.as_ref() {
Expand Down

0 comments on commit 007630e

Please sign in to comment.