total transitions is helpful
This commit is contained in:
parent
58568716da
commit
661d642cd2
|
@ -59,7 +59,7 @@ public class ByteRateOfChange {
|
||||||
for (int byteIndex = 0; byteIndex < packet.getData().length; byteIndex++) {
|
for (int byteIndex = 0; byteIndex < packet.getData().length; byteIndex++) {
|
||||||
ByteId key = new ByteId(packet.getId(), byteIndex);
|
ByteId key = new ByteId(packet.getId(), byteIndex);
|
||||||
ByteStatistics stats = traceFileMetaIndex.statistics.computeIfAbsent(key, byteId -> new ByteStatistics(key));
|
ByteStatistics stats = traceFileMetaIndex.statistics.computeIfAbsent(key, byteId -> new ByteStatistics(key));
|
||||||
stats.uniqueValues.add((int) packet.getData()[byteIndex]);
|
stats.registerValue(packet.getData()[byteIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return traceFileMetaIndex;
|
return traceFileMetaIndex;
|
||||||
|
@ -78,9 +78,12 @@ public class ByteRateOfChange {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ByteStatistics {
|
public static class ByteStatistics {
|
||||||
HashSet<Integer> uniqueValues = new HashSet<>();
|
private final HashSet<Integer> uniqueValues = new HashSet<>();
|
||||||
|
int totalTransitions;
|
||||||
private final ByteId key;
|
private final ByteId key;
|
||||||
|
|
||||||
|
private int previousValue;
|
||||||
|
|
||||||
public ByteStatistics(ByteId key) {
|
public ByteStatistics(ByteId key) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
}
|
}
|
||||||
|
@ -100,6 +103,16 @@ public class ByteRateOfChange {
|
||||||
", key=" + key +
|
", key=" + key +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void registerValue(int value) {
|
||||||
|
if (!uniqueValues.isEmpty()) {
|
||||||
|
if (previousValue != value)
|
||||||
|
totalTransitions++;
|
||||||
|
}
|
||||||
|
|
||||||
|
previousValue = value;
|
||||||
|
uniqueValues.add(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class ByteRateOfChangeReports {
|
||||||
String msg = id + ": " + s1.getUniqueValuesCount() + " vs " + s2.getUniqueValuesCount();
|
String msg = id + ": " + s1.getUniqueValuesCount() + " vs " + s2.getUniqueValuesCount();
|
||||||
int deltaCount = Math.abs(s1.getUniqueValuesCount() - s2.getUniqueValuesCount());
|
int deltaCount = Math.abs(s1.getUniqueValuesCount() - s2.getUniqueValuesCount());
|
||||||
differences.add(new ByteVariationDifference(deltaCount, msg));
|
differences.add(new ByteVariationDifference(deltaCount, msg));
|
||||||
report.println(msg + " delta=" + deltaCount);
|
report.println(msg + " delta=" + deltaCount + " / " + s1.totalTransitions + " vs " + s2.totalTransitions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue