Replace eprintlns by tracing

This commit is contained in:
Clément Renault 2024-11-20 15:29:51 +01:00
parent 4d616f8794
commit a38344acb3
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F
4 changed files with 5 additions and 7 deletions

View File

@ -202,7 +202,7 @@ impl Drop for ExtractorSender {
let send_count = *self.send_count.get_mut(); let send_count = *self.send_count.get_mut();
let writer_contentious_count = *self.writer_contentious_count.get_mut(); let writer_contentious_count = *self.writer_contentious_count.get_mut();
let extractor_contentious_count = *self.extractor_contentious_count.get_mut(); let extractor_contentious_count = *self.extractor_contentious_count.get_mut();
eprintln!( tracing::debug!(
"Extractor channel stats: {send_count} sends, \ "Extractor channel stats: {send_count} sends, \
{writer_contentious_count} writer contentions ({}%), \ {writer_contentious_count} writer contentions ({}%), \
{extractor_contentious_count} extractor contentions ({}%)", {extractor_contentious_count} extractor contentions ({}%)",

View File

@ -160,14 +160,14 @@ impl<'extractor> BalancedCaches<'extractor> {
let BalancedCaches { hasher: _, alloc, max_memory: _, caches } = self; let BalancedCaches { hasher: _, alloc, max_memory: _, caches } = self;
if let InnerCaches::Normal(normal_caches) = caches { if let InnerCaches::Normal(normal_caches) = caches {
eprintln!( tracing::trace!(
"We are spilling after we allocated {} bytes on thread #{}", "We are spilling after we allocated {} bytes on thread #{}",
alloc.allocated_bytes(), alloc.allocated_bytes(),
rayon::current_thread_index().unwrap_or(0) rayon::current_thread_index().unwrap_or(0)
); );
let allocated: usize = normal_caches.caches.iter().map(|m| m.allocation_size()).sum(); let allocated: usize = normal_caches.caches.iter().map(|m| m.allocation_size()).sum();
eprintln!("The last allocated HashMap took {allocated} bytes"); tracing::trace!("The last allocated HashMap took {allocated} bytes");
let dummy = NormalCaches { caches: Vec::new() }; let dummy = NormalCaches { caches: Vec::new() };
let NormalCaches { caches: cache_maps } = mem::replace(normal_caches, dummy); let NormalCaches { caches: cache_maps } = mem::replace(normal_caches, dummy);

View File

@ -224,10 +224,10 @@ where
MSP: Fn() -> bool + Sync, MSP: Fn() -> bool + Sync,
SP: Fn(Progress) + Sync, SP: Fn(Progress) + Sync,
{ {
eprintln!("We are resetting the extractor allocators"); tracing::trace!("We are resetting the extractor allocators");
// Clean up and reuse the extractor allocs // Clean up and reuse the extractor allocs
for extractor_alloc in extractor_allocs.iter_mut() { for extractor_alloc in extractor_allocs.iter_mut() {
eprintln!("\tWith {} bytes resetted", extractor_alloc.0.allocated_bytes()); tracing::trace!("\tWith {} bytes reset", extractor_alloc.0.allocated_bytes());
extractor_alloc.0.reset(); extractor_alloc.0.reset();
} }

View File

@ -491,7 +491,6 @@ fn compute_prefix_database(
wtxn: &mut RwTxn, wtxn: &mut RwTxn,
prefix_delta: PrefixDelta, prefix_delta: PrefixDelta,
) -> Result<()> { ) -> Result<()> {
eprintln!("prefix_delta: {:?}", &prefix_delta);
let PrefixDelta { modified, deleted } = prefix_delta; let PrefixDelta { modified, deleted } = prefix_delta;
// Compute word prefix docids // Compute word prefix docids
compute_word_prefix_docids(wtxn, index, &modified, &deleted)?; compute_word_prefix_docids(wtxn, index, &modified, &deleted)?;
@ -609,7 +608,6 @@ fn compute_facet_level_database(
wtxn: &mut RwTxn, wtxn: &mut RwTxn,
facet_field_ids_delta: FacetFieldIdsDelta, facet_field_ids_delta: FacetFieldIdsDelta,
) -> Result<()> { ) -> Result<()> {
eprintln!("facet_field_ids_delta: {:?}", &facet_field_ids_delta);
if let Some(modified_facet_string_ids) = facet_field_ids_delta.modified_facet_string_ids() { if let Some(modified_facet_string_ids) = facet_field_ids_delta.modified_facet_string_ids() {
let span = tracing::trace_span!(target: "indexing::facet_field_ids", "string"); let span = tracing::trace_span!(target: "indexing::facet_field_ids", "string");
let _entered = span.enter(); let _entered = span.enter();