прогресс пакетов сапфор
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package TestingSystem.Common.ThreadsPlanner;
|
||||
import Common.Global;
|
||||
import Common.Utils.InterruptThread;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public abstract class ThreadsPlanner {
|
||||
@@ -20,6 +22,8 @@ public abstract class ThreadsPlanner {
|
||||
//---
|
||||
protected int threadMaxId = 0;
|
||||
protected int wait_ms;
|
||||
protected int done_threads = 0;
|
||||
protected int progress = 0;
|
||||
protected LinkedHashMap<Integer, Thread> threads = new LinkedHashMap<>();
|
||||
protected Vector<Integer> activeThreads = new Vector<>();
|
||||
protected Vector<Integer> waitingThreads = new Vector<>();
|
||||
@@ -74,10 +78,20 @@ public abstract class ThreadsPlanner {
|
||||
if (!thread.isAlive()) {
|
||||
toExclude.add(i);
|
||||
kernels++;
|
||||
done_threads++;
|
||||
}
|
||||
}
|
||||
activeThreads.removeAll(toExclude);
|
||||
//--
|
||||
double progress = ((double)done_threads/threads.size())*100.0;
|
||||
Global.Log.Print("done_threads="+done_threads+";all_threads="+threads.size()+";progress="+progress);
|
||||
File progress_file = new File("progress");
|
||||
try {
|
||||
FileUtils.writeStringToFile(progress_file, String.valueOf(((int)progress)));
|
||||
}
|
||||
catch (Exception exception){
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
protected void tryStartThreads() throws Exception {
|
||||
Vector<Integer> toExclude = new Vector<>();
|
||||
|
||||
Reference in New Issue
Block a user