Skip to content

Commit

Permalink
Add more timing log information
Browse files Browse the repository at this point in the history
  • Loading branch information
hextraza committed Feb 16, 2023
1 parent 5ffa250 commit a7495e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/parse/bam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use super::sorted_bam_reader::SortedBamReader;
use debruijn::dna_string::DnaString;
use rust_htslib::bam::record::Aux;

use std::time::{Duration, Instant};

const READ_BLOCK_REPORT_SIZE: usize = 1000000;
const MAX_RECORD_ERROR_REPORT_SIZE: usize = 100;

Expand Down Expand Up @@ -67,12 +69,16 @@ impl UMIReader {
self.next_iteration_key.clear();

loop {
let start = Instant::now();
let r = self.reader.next();
let duration = start.elapsed();
//println!("time to load read read/sort UMI from disk: {:?}", duration);

if r.is_err() {
return None;
}

let start = Instant::now();
self.read_counter = self.read_counter + 1;

if self.read_counter % READ_BLOCK_REPORT_SIZE == 0 && self.read_counter != 0 {
Expand Down Expand Up @@ -160,13 +166,19 @@ impl UMIReader {
self.current_cell_barcode = current_cell_barcode.clone();

self.current_iteration_key = current_iteration_key;

let duration = start.elapsed();
//println!("time to push read to readlist: {:?}", duration);
} else {
self.next_umi_group.push(seq);
self.next_metadata_group
.push((mapq, orientation, pair, rev_comp, hit));
self.next_umi = read_umi.clone();
self.next_cell_barcode = current_cell_barcode;
self.next_iteration_key = current_iteration_key;

let duration = start.elapsed();
//println!("time to push read to NEXT readlist: {:?}", duration);
return Some(true);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/parse/sorted_bam_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ impl SortedBamReader {
}

fn fill_buffer(&mut self) {
println!("filling buffer and sorting");
self.dna_sorted_buffer.clear();
self.dna_sorted_buffer.append(&mut self.next_records);
self.current_umi = self.next_umi.clone();
Expand Down

0 comments on commit a7495e0

Please sign in to comment.