рефакторинг определения размерности тестов на сервере.
This commit is contained in:
@@ -7,8 +7,6 @@ import Common.Utils.Utils_;
|
||||
import Common.Visual.UI;
|
||||
import Common.Visual.Windows.Dialog.VFileChooser_;
|
||||
import _VisualDVM.GlobalData.Tasks.TaskState;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.ProjectData.Project.db_project_info;
|
||||
import javafx.util.Pair;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
@@ -19,7 +17,6 @@ import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.*;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.*;
|
||||
@@ -358,56 +355,6 @@ public class Utils {
|
||||
if (matrix.trim().isEmpty()) return 0;
|
||||
return matrix.split(" ").length;
|
||||
}
|
||||
|
||||
public static int getCTestMaxDim(File test) {
|
||||
int fileMax = 0;
|
||||
final String prefix = "#pragma dvm array distribute";
|
||||
int n = 0;
|
||||
try {
|
||||
for (String line : FileUtils.readLines(test, Charset.defaultCharset())) {
|
||||
// #pragma dvm array distribute[block][block], не важно
|
||||
String packedLine = Utils_.removeCharacters(Utils_.removeRedundantSpaces(line).toLowerCase(), "\n", "\r", "\t");
|
||||
if (packedLine.startsWith(prefix)) {
|
||||
packedLine = packedLine.substring(prefix.length());
|
||||
boolean bracketOpen = false;
|
||||
int pragmaMax = 0;
|
||||
String distr = "";
|
||||
for (int i = packedLine.indexOf('['); i < packedLine.length(); ++i) {
|
||||
char c = packedLine.charAt(i);
|
||||
if (bracketOpen) {
|
||||
if (c == ']') {
|
||||
bracketOpen = false;
|
||||
if (distr.equals("block"))
|
||||
pragmaMax++;
|
||||
distr = "";
|
||||
} else {
|
||||
distr += c;
|
||||
}
|
||||
} else {
|
||||
if (c == '[') {
|
||||
bracketOpen = true;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fileMax = Math.max(fileMax, pragmaMax);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return fileMax;
|
||||
}
|
||||
public static int getCProjectMaxDim(db_project_info project) {
|
||||
int res = 0;
|
||||
for (DBProjectFile file : project.db.files.Data.values()) {
|
||||
if (file.isActiveProgram())
|
||||
res = Math.max(res, getCTestMaxDim(file.file));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public static boolean isTimeout(long startDate, long maxtime_sec) {
|
||||
Date now = new Date();
|
||||
long delta = (now.getTime() - startDate) / 1000;
|
||||
|
||||
Reference in New Issue
Block a user