Compare commits
4 Commits
3e2f3fd5eb
...
b08dd8cf72
Author | SHA1 | Date |
---|---|---|
rusefillc | b08dd8cf72 | |
rusefillc | 925526673a | |
rusefillc | f9cd363abf | |
rusefillc | aa5b1f2fea |
|
@ -1,6 +1,6 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|
|
@ -11,14 +11,14 @@ public class ByteRateOfChangeReports {
|
||||||
/**
|
/**
|
||||||
* sweet baby O(n^2)
|
* sweet baby O(n^2)
|
||||||
*/
|
*/
|
||||||
public static void compareEachReportAgainstAllOthers(String reportDestinationFolder, List<ByteRateOfChange.TraceReport> reports, CanContext context) throws FileNotFoundException {
|
public static void compareEachReportAgainstAllOthers(String reportDestinationFolder, List<ByteRateOfChange.TraceReport> reports, CanMetaDataContext context) throws FileNotFoundException {
|
||||||
for (int i = 0; i < reports.size(); i++) {
|
for (int i = 0; i < reports.size(); i++) {
|
||||||
for (int j = i + 1; j < reports.size(); j++)
|
for (int j = i + 1; j < reports.size(); j++)
|
||||||
compareTwoReports(reportDestinationFolder, reports.get(i), reports.get(j), context);
|
compareTwoReports(reportDestinationFolder, reports.get(i), reports.get(j), context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void compareTwoReports(String reportDestinationFolder, ByteRateOfChange.TraceReport traceReport1, ByteRateOfChange.TraceReport traceReport2, CanContext context) throws FileNotFoundException {
|
private static void compareTwoReports(String reportDestinationFolder, ByteRateOfChange.TraceReport traceReport1, ByteRateOfChange.TraceReport traceReport2, CanMetaDataContext context) throws FileNotFoundException {
|
||||||
Set<ByteRateOfChange.ByteId> allKeys = new TreeSet<>();
|
Set<ByteRateOfChange.ByteId> allKeys = new TreeSet<>();
|
||||||
allKeys.addAll(traceReport1.getStatistics().keySet());
|
allKeys.addAll(traceReport1.getStatistics().keySet());
|
||||||
allKeys.addAll(traceReport2.getStatistics().keySet());
|
allKeys.addAll(traceReport2.getStatistics().keySet());
|
||||||
|
@ -92,7 +92,7 @@ public class ByteRateOfChangeReports {
|
||||||
public static void scanInputFolder(String inputFolderName, String fileNameSuffix) throws IOException {
|
public static void scanInputFolder(String inputFolderName, String fileNameSuffix) throws IOException {
|
||||||
String reportDestinationFolder = createOutputFolder(inputFolderName);
|
String reportDestinationFolder = createOutputFolder(inputFolderName);
|
||||||
|
|
||||||
CanContext context = CanContext.read(inputFolderName);
|
CanMetaDataContext context = CanMetaDataContext.read(inputFolderName);
|
||||||
|
|
||||||
List<ByteRateOfChange.TraceReport> reports = new ArrayList<>();
|
List<ByteRateOfChange.TraceReport> reports = new ArrayList<>();
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,13 @@ import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class CanContext {
|
public class CanMetaDataContext {
|
||||||
final Set<Integer> withChecksum = new HashSet<>();
|
final Set<Integer> withChecksum = new HashSet<>();
|
||||||
final Map<Integer, Map<Integer, Integer>> countersMap;
|
final Map<Integer, Map<Integer, Integer>> countersMap;
|
||||||
|
|
||||||
Set<ByteRateOfChange.ByteId> counterBytes = new HashSet<>();
|
Set<ByteRateOfChange.ByteId> counterBytes = new HashSet<>();
|
||||||
|
|
||||||
private CanContext(List<Integer> withChecksum, Map<Integer, Map<Integer, Integer>> countersMap) {
|
private CanMetaDataContext(List<Integer> withChecksum, Map<Integer, Map<Integer, Integer>> countersMap) {
|
||||||
this.countersMap = countersMap;
|
this.countersMap = countersMap;
|
||||||
this.withChecksum.addAll(withChecksum);
|
this.withChecksum.addAll(withChecksum);
|
||||||
|
|
||||||
|
@ -33,17 +33,17 @@ public class CanContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CanContext read(String inputFolderName) throws FileNotFoundException {
|
public static CanMetaDataContext read(String inputFolderName) throws FileNotFoundException {
|
||||||
Yaml checksum = new Yaml();
|
Yaml checksum = new Yaml();
|
||||||
String checkSumFileName = inputFolderName + File.separator + ChecksumScanner.CHECKSUM_YAML;
|
String checkSumFileName = inputFolderName + File.separator + ChecksumScanner.CHECKSUM_YAML;
|
||||||
if (!new File(checkSumFileName).exists())
|
if (!new File(checkSumFileName).exists())
|
||||||
return new CanContext(new ArrayList<>(), new HashMap<>());
|
return new CanMetaDataContext(new ArrayList<>(), new HashMap<>());
|
||||||
|
|
||||||
List<Integer> withChecksum = checksum.load(new FileReader(checkSumFileName));
|
List<Integer> withChecksum = checksum.load(new FileReader(checkSumFileName));
|
||||||
|
|
||||||
Yaml countersYaml = new Yaml();
|
Yaml countersYaml = new Yaml();
|
||||||
Map<Integer, Map<Integer, Integer>> countersMap = countersYaml.load(new FileReader(inputFolderName + File.separator + CounterScanner.COUNTERS_YAML));
|
Map<Integer, Map<Integer, Integer>> countersMap = countersYaml.load(new FileReader(inputFolderName + File.separator + CounterScanner.COUNTERS_YAML));
|
||||||
|
|
||||||
return new CanContext(withChecksum, countersMap);
|
return new CanMetaDataContext(withChecksum, countersMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -41,7 +41,11 @@ public interface CANLineReader {
|
||||||
return readLine(line, "no-file-name");
|
return readLine(line, "no-file-name");
|
||||||
}
|
}
|
||||||
|
|
||||||
CANPacket readLine(String line, String fileName);
|
default CANPacket readLine(String line, String fileName) {
|
||||||
|
return readLine(line, fileName, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
CANPacket readLine(String line, String fileName, int lineIndex);
|
||||||
|
|
||||||
default List<CANPacket> readFile(String fileName) throws IOException {
|
default List<CANPacket> readFile(String fileName) throws IOException {
|
||||||
return skipHeaderAndRead(fileName, 0);
|
return skipHeaderAndRead(fileName, 0);
|
||||||
|
@ -57,7 +61,7 @@ public interface CANLineReader {
|
||||||
public void accept(String s) {
|
public void accept(String s) {
|
||||||
if (index++ < skipCount)
|
if (index++ < skipCount)
|
||||||
return;
|
return;
|
||||||
CANPacket packet = readLine(s, fileName);
|
CANPacket packet = readLine(s, fileName, index);
|
||||||
if (packet != null)
|
if (packet != null)
|
||||||
result.add(packet);
|
result.add(packet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ public enum CANoeReader implements CANLineReader {
|
||||||
INSTANCE;
|
INSTANCE;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CANPacket readLine(String line, String fileName) {
|
public CANPacket readLine(String line, String fileName, int lineIndex) {
|
||||||
if (line.contains("ErrorFrame"))
|
if (line.contains("ErrorFrame"))
|
||||||
return null;
|
return null;
|
||||||
String[] tokens = line.trim().split("\\s+");
|
String[] tokens = line.trim().split("\\s+");
|
||||||
|
|
|
@ -18,7 +18,7 @@ public enum CanHackerReader implements CANLineReader {
|
||||||
INSTANCE;
|
INSTANCE;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CANPacket readLine(String line, String fileName) {
|
public CANPacket readLine(String line, String fileName, int lineIndex) {
|
||||||
line = line.trim();
|
line = line.trim();
|
||||||
if (line.startsWith("@"))
|
if (line.startsWith("@"))
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -19,8 +19,8 @@ public class PcanAutoReader implements CANLineReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CANPacket readLine(String line, String fileName) {
|
public CANPacket readLine(String line, String fileName, int lineIndex) {
|
||||||
return delegate.readLine(line, fileName);
|
return delegate.readLine(line, fileName, lineIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,13 +13,15 @@ public class PcanTrcReader1_1 implements CANLineReader {
|
||||||
public static final CANLineReader INSTANCE = new PcanTrcReader1_1();
|
public static final CANLineReader INSTANCE = new PcanTrcReader1_1();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CANPacket readLine(String line, String fileName) {
|
public CANPacket readLine(String line, String fileName, int lineIndex) {
|
||||||
line = line.trim();
|
line = line.trim();
|
||||||
if (line.startsWith(FILEVERSION) && !line.startsWith(FILEVERSION + "=1.1"))
|
if (line.startsWith(FILEVERSION) && !line.startsWith(FILEVERSION + "=1.1"))
|
||||||
throw new IllegalStateException("Unexpected fileversion " + line);
|
throw new IllegalStateException("Unexpected fileversion " + line);
|
||||||
if (line.startsWith(";"))
|
if (line.startsWith(";"))
|
||||||
return null;
|
return null;
|
||||||
String[] tokens = line.split("\\s+");
|
String[] tokens = line.split("\\s+");
|
||||||
|
if (tokens.length < 2)
|
||||||
|
throw new IllegalStateException("Unexpected token count in " + fileName + "@" + lineIndex + ": [" + line + "]");
|
||||||
double timeStamp = Double.parseDouble(tokens[1]);
|
double timeStamp = Double.parseDouble(tokens[1]);
|
||||||
|
|
||||||
int sid = Integer.parseInt(tokens[3], 16);
|
int sid = Integer.parseInt(tokens[3], 16);
|
||||||
|
|
|
@ -13,7 +13,7 @@ public enum PcanTrcReader2_0 implements CANLineReader {
|
||||||
public static final String FILEVERSION = ";$FILEVERSION";
|
public static final String FILEVERSION = ";$FILEVERSION";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CANPacket readLine(String line, String fileName) {
|
public CANPacket readLine(String line, String fileName, int lineIndex) {
|
||||||
line = line.trim();
|
line = line.trim();
|
||||||
if (line.startsWith(FILEVERSION) && !line.startsWith(FILEVERSION + "=2.0"))
|
if (line.startsWith(FILEVERSION) && !line.startsWith(FILEVERSION + "=2.0"))
|
||||||
throw new IllegalStateException("Unexpected fileversion " + line + " in " + fileName);
|
throw new IllegalStateException("Unexpected fileversion " + line + " in " + fileName);
|
||||||
|
|
Loading…
Reference in New Issue