Compare commits

...

3 Commits

Author SHA1 Message Date
rusefillc 6e5411ff86 PacketRatio 2024-04-10 18:36:17 -04:00
rusefillc 3501ac3b32 logging 2024-04-10 18:36:06 -04:00
rusefillc 8933621961 logging 2024-04-10 18:35:47 -04:00
4 changed files with 10 additions and 6 deletions

View File

@ -18,7 +18,7 @@ public class CANPacket {
result.append(arrayName + " = {");
byte[] data = getData();
System.out.println(String.format("Got ECU 0x%x", getId()) + " " + data.length);
// System.out.println(String.format("Got ECU 0x%x", getId()) + " " + data.length);
for (int index = 0; index < data.length; index++) {
if (index > 0)

View File

@ -126,7 +126,7 @@ public class ByteRateOfChangeReports {
CanToMegaLogViewer.createMegaLogViewer(reportDestinationFolder, logFileContent, simpleFileName);
PacketRatio.write(reportDestinationFolder, logFileContent, simpleFileName);
PacketRatio.write(dbc, reportDestinationFolder, logFileContent, simpleFileName);
ByteRateOfChange.TraceReport report = ByteRateOfChange.process(reportDestinationFolder, simpleFileName, logFileContent);
report.save(simpleFileName + "-ByteRateOfChange.txt");

View File

@ -37,7 +37,7 @@ public class ChecksumScanner {
for (Map.Entry<Integer, AtomicBoolean> e : isChecksumMap.entrySet()) {
if (e.getValue().get()) {
Integer sid = e.getKey();
System.out.println("Ends with checksum " + sid);
System.out.println("ChecksumScanner: Ends with checksum " + sid);
withChecksum.add(sid);
}
}

View File

@ -1,7 +1,8 @@
package com.rusefi.can.analysis;
import com.rusefi.can.CANPacket;
import com.rusefi.can.DualSid;
import com.rusefi.can.reader.dbc.DbcFile;
import com.rusefi.can.reader.dbc.DbcPacket;
import java.io.File;
import java.io.FileWriter;
@ -14,7 +15,7 @@ import java.util.concurrent.atomic.AtomicInteger;
public class PacketRatio {
public static void write(String reportDestinationFolder, List<CANPacket> logFileContent, String simpleFileName) throws IOException {
public static void write(DbcFile dbc, String reportDestinationFolder, List<CANPacket> logFileContent, String simpleFileName) throws IOException {
Map<Integer, AtomicInteger> countBySID = new TreeMap<>();
@ -27,7 +28,10 @@ public class PacketRatio {
for (Map.Entry<Integer, AtomicInteger> e : countBySID.entrySet()) {
double ratio = 100.0 * e.getValue().get() / logFileContent.size();
w.write(DualSid.dualSid(e.getKey()) + ": " + ratio + "\n");
Integer sid = e.getKey();
DbcPacket packet = dbc == null ? null : dbc.packets.get(sid);
String key = packet == null ? Integer.toString(sid) : packet.getName();
w.write(key + ": " + ratio + "\n");
}
w.close();
}