progress
This commit is contained in:
parent
a65745f07b
commit
b871f745a6
|
@ -22,22 +22,30 @@ public class ByteRateOfChange {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void writeByteReport(String reportDestinationFolder, String simpleFileName, TraceFileMetaIndex traceFileMetaIndex) throws FileNotFoundException {
|
private static void writeByteReport(String reportDestinationFolder, String simpleFileName, TraceFileMetaIndex traceFileMetaIndex) throws FileNotFoundException {
|
||||||
|
String byteChangesFolder = reportDestinationFolder + File.separator + "byte_changes";
|
||||||
|
new File(byteChangesFolder).mkdirs();
|
||||||
|
|
||||||
List<ByteStatistics> allStats = new ArrayList<>(traceFileMetaIndex.statistics.values());
|
List<ByteStatistics> allStats = new ArrayList<>(traceFileMetaIndex.statistics.values());
|
||||||
allStats.sort((o1, o2) -> o2.getUniqueValues() - o1.getUniqueValues());
|
allStats.sort((o1, o2) -> o2.getUniqueValuesCount() - o1.getUniqueValuesCount());
|
||||||
|
|
||||||
// System.out.println(allStats);
|
writeByteReport(allStats, byteChangesFolder + File.separator + simpleFileName + "byte_rate_of_changes_sorted_counter.txt");
|
||||||
|
|
||||||
writeByteReport(reportDestinationFolder, simpleFileName, allStats);
|
allStats.sort(new Comparator<ByteStatistics>() {
|
||||||
|
@Override
|
||||||
|
public int compare(ByteStatistics o1, ByteStatistics o2) {
|
||||||
|
return o1.key.compareTo(o2.key);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
writeByteReport(allStats, byteChangesFolder + File.separator + simpleFileName + "byte_rate_of_changes_sorted_index.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void writeByteReport(String reportDestinationFolder, String simpleFileName, List<ByteStatistics> allStats) throws FileNotFoundException {
|
private static void writeByteReport(List<ByteStatistics> allStats, String fileName) throws FileNotFoundException {
|
||||||
String outputFileName = reportDestinationFolder + File.separator + simpleFileName + ".txt";
|
System.out.println("Writing byte report to " + fileName);
|
||||||
System.out.println("Writing byte report to " + outputFileName);
|
PrintStream ps = new PrintStream(new FileOutputStream(fileName, false));
|
||||||
PrintStream ps = new PrintStream(new FileOutputStream(outputFileName, false));
|
|
||||||
|
|
||||||
for (ByteStatistics byteStatistics : allStats) {
|
for (ByteStatistics byteStatistics : allStats) {
|
||||||
ByteId key = byteStatistics.key;
|
ByteId key = byteStatistics.key;
|
||||||
ps.println(dualSid(key.sid) + " byte " + key.index + " has " + byteStatistics.getUniqueValues() + " unique value(s)");
|
ps.println(dualSid(key.sid) + " byte " + key.index + " has " + byteStatistics.getUniqueValuesCount() + " unique value(s)");
|
||||||
}
|
}
|
||||||
|
|
||||||
ps.close();
|
ps.close();
|
||||||
|
@ -77,10 +85,14 @@ public class ByteRateOfChange {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUniqueValues() {
|
public int getUniqueValuesCount() {
|
||||||
return uniqueValues.size();
|
return uniqueValues.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ByteId getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ByteStatistics{" +
|
return "ByteStatistics{" +
|
||||||
|
|
|
@ -40,9 +40,9 @@ public class ByteRateOfChangeReports {
|
||||||
ByteRateOfChange.ByteStatistics s1 = traceReport1.getStatistics().computeIfAbsent(id, ByteRateOfChange.ByteStatistics::new);
|
ByteRateOfChange.ByteStatistics s1 = traceReport1.getStatistics().computeIfAbsent(id, ByteRateOfChange.ByteStatistics::new);
|
||||||
ByteRateOfChange.ByteStatistics s2 = traceReport2.getStatistics().computeIfAbsent(id, ByteRateOfChange.ByteStatistics::new);
|
ByteRateOfChange.ByteStatistics s2 = traceReport2.getStatistics().computeIfAbsent(id, ByteRateOfChange.ByteStatistics::new);
|
||||||
|
|
||||||
if (s1.getUniqueValues() != s2.getUniqueValues()) {
|
if (s1.getUniqueValuesCount() != s2.getUniqueValuesCount()) {
|
||||||
String msg = id + ": " + s1.getUniqueValues() + " vs " + s2.getUniqueValues();
|
String msg = id + ": " + s1.getUniqueValuesCount() + " vs " + s2.getUniqueValuesCount();
|
||||||
int deltaCount = Math.abs(s1.getUniqueValues() - s2.getUniqueValues());
|
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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue