checkDataIntegrity - borg mount optimizations;
git-svn-id: svn://home0/checkDataIntegrity@3518 71dcc7fd-b1f2-4e5d-bb8e-274146e81173
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
package checkDataIntegrity;
|
||||
|
||||
|
||||
record Args(String path0, String path1, int skip, int timeLimit) {
|
||||
record Args(String path0, String path1, int threads, int skip, int timeLimit) {
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class BufferPool {
|
||||
static byte[] get() {
|
||||
byte[] buf = queue.poll();
|
||||
if (buf == null) {
|
||||
buf = new byte[16384];
|
||||
buf = new byte[4096];
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -18,9 +18,46 @@ public class Main {
|
||||
}
|
||||
|
||||
final ProgramState state = new ProgramState(System.currentTimeMillis(), new AtomicLong(), new AtomicLong(), new AtomicLong());
|
||||
final WorkerPool workerPool = new WorkerPool(parsedArgs, state, parsedArgs.threads());
|
||||
|
||||
final WorkerPool workerPool = new WorkerPool(parsedArgs, state, 32);
|
||||
walk(parsedArgs, state, workerPool);
|
||||
|
||||
workerPool.awaitEmpty();
|
||||
workerPool.interrupt();
|
||||
workerPool.join();
|
||||
|
||||
printStats(state);
|
||||
|
||||
System.exit(state.countErr().get() > 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
private static Args parseArgs(final String[] args) {
|
||||
if (args.length < 4) {
|
||||
System.err.println("Usage: checkDataIntegrity.java <Path0> <Path1> <threads> <skip> <timeLimit ms>");
|
||||
return null;
|
||||
}
|
||||
|
||||
final Args result = new Args(
|
||||
args[0],
|
||||
args[1],
|
||||
Integer.parseInt(args[2]),
|
||||
Integer.parseInt(args[3]),
|
||||
Integer.parseInt(args[4]));
|
||||
System.out.println(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void printStats(final ProgramState state) {
|
||||
final Duration duration = Duration.ofMillis(System.currentTimeMillis() - state.start());
|
||||
System.out.println("Took: " + duration.toString());
|
||||
System.out.println("Files checked: " + state.count().get());
|
||||
if (duration.toSeconds() > 0) {
|
||||
System.out.println("Throughput: " + (state.bytes().get() / duration.toSeconds() / 1024 / 1024) + " Mib/s");
|
||||
}
|
||||
System.out.println("Errors: " + state.countErr().get());
|
||||
}
|
||||
|
||||
private static void walk(final Args parsedArgs, final ProgramState state, final WorkerPool workerPool) throws IOException {
|
||||
final AtomicLong walkTreeCounter = new AtomicLong();
|
||||
Files.walkFileTree(Path.of(parsedArgs.path0()), new FileVisitor<>() {
|
||||
|
||||
@@ -57,39 +94,5 @@ public class Main {
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
});
|
||||
|
||||
workerPool.awaitEmpty();
|
||||
workerPool.interrupt();
|
||||
workerPool.join();
|
||||
|
||||
printStats(state);
|
||||
|
||||
System.exit(state.countErr().get() > 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
private static Args parseArgs(final String[] args) {
|
||||
if (args.length < 4) {
|
||||
System.err.println("Usage: checkDataIntegrity.java <Path0> <Path1> <skip> <timeLimit ms>");
|
||||
return null;
|
||||
}
|
||||
|
||||
final Args result = new Args(
|
||||
args[0],
|
||||
args[1],
|
||||
Integer.parseInt(args[2]),
|
||||
Integer.parseInt(args[3]));
|
||||
System.out.println(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void printStats(final ProgramState state) {
|
||||
final Duration duration = Duration.ofMillis(System.currentTimeMillis() - state.start());
|
||||
System.out.println("Took: " + duration.toString());
|
||||
System.out.println("Files checked: " + state.count().get());
|
||||
if (duration.toSeconds() > 0) {
|
||||
System.out.println("Throughput: " + (state.bytes().get() / duration.toSeconds() / 1024 / 1024) + " Mib/s");
|
||||
}
|
||||
System.out.println("Errors: " + state.countErr().get());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user