Skip to content

Commit

Permalink
Merge pull request #284 from wcampbell0x2a/correct-unsquashfs-time-spent
Browse files Browse the repository at this point in the history
Correct unsquashfs time spent
  • Loading branch information
wcampbell0x2a authored Aug 12, 2023
2 parents d7ab3c0 + 698c85a commit d59e184
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/bin/unsquashfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,12 @@ fn main() -> ExitCode {
let red_bold: console::Style = console::Style::new().blue().bold();
let pb = ProgressBar::new_spinner();

if !args.quiet {
pb.enable_steady_tick(Duration::from_millis(120));
let line = format!("{:>14}", blue_bold.apply_to("Searching for magic"));
pb.set_message(line);
}

if args.auto_offset {
if !args.quiet {
pb.enable_steady_tick(Duration::from_millis(120));
let line = format!("{:>14}", blue_bold.apply_to("Searching for magic"));
pb.set_message(line);
}
if let Some(found_offset) = find_offset(&mut file, &kind) {
if !args.quiet {
let line = format!(
Expand Down Expand Up @@ -217,6 +216,7 @@ fn main() -> ExitCode {

// Start new spinner as we extract all the inode and other information from the image
// This can be very time consuming
let start = Instant::now();
let pb = ProgressBar::new_spinner();
if !args.quiet {
pb.enable_steady_tick(Duration::from_millis(120));
Expand Down Expand Up @@ -287,6 +287,7 @@ fn main() -> ExitCode {
.collect::<Vec<&Node<SquashfsFileReader>>>()
.into_par_iter(),
n_nodes,
start,
);
}

Expand Down Expand Up @@ -404,9 +405,8 @@ fn extract_all<'a, S: ParallelIterator<Item = &'a Node<SquashfsFileReader>>>(
root_process: bool,
nodes: S,
n_nodes: Option<usize>,
start: Instant,
) {
let start = Instant::now();

let pb = ProgressBar::new(n_nodes.unwrap_or(0) as u64);
if !args.quiet {
pb.set_style(ProgressStyle::default_spinner());
Expand Down
2 changes: 2 additions & 0 deletions src/squashfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ impl Squashfs {
/// like structure in-memory
#[instrument(skip_all)]
pub fn into_filesystem_reader(self) -> Result<FilesystemReader, BackhandError> {
info!("creating fs tree");
let mut root = Nodes::new_root(NodeHeader::from_inode(self.root_inode.header, &self.id));
self.extract_dir(
&mut PathBuf::from("/"),
Expand All @@ -640,6 +641,7 @@ impl Squashfs {
)?;
root.nodes.sort();

info!("created fs tree");
let filesystem = FilesystemReader {
kind: self.kind,
block_size: self.superblock.block_size,
Expand Down

0 comments on commit d59e184

Please sign in to comment.