forked from KSXGitHub/parallel-disk-usage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: limit thread number to 1 when HDD is detected
On HDD, multi-threaded du won't provide any performance benefit over the single-threaded one. Therefore, when HDD is detected on one of the files, limit the thread number to 1. This PR fixes issue KSXGitHub#257.
- Loading branch information
1 parent
ce88bd4
commit 0e7a836
Showing
4 changed files
with
173 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use parallel_disk_usage::app::sub::find_mountpoint; | ||
use std::path::Path; | ||
|
||
#[test] | ||
fn test_mountpoint() { | ||
let mount_points = &[ | ||
Path::new("/"), | ||
Path::new("/home"), | ||
Path::new("/mnt/data"), | ||
Path::new("/mnt/data/repo"), | ||
Path::new("/mnt/repo"), | ||
]; | ||
|
||
for (path, mount_point) in &[ | ||
("/etc/fstab", "/"), | ||
("/home/user", "/home"), | ||
("/mnt/data/repo/test", "/mnt/data/repo"), | ||
("/mnt/data/test/test", "/mnt/data/"), | ||
("/mnt/repo/test/test", "/mnt/repo/"), | ||
] { | ||
assert_eq!( | ||
find_mountpoint(Path::new(path), mount_points).unwrap(), | ||
Path::new(mount_point) | ||
); | ||
} | ||
} |