-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
453 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* | ||
* @author Daniel Tischner {@literal <[email protected]>} | ||
*/ | ||
@SuppressWarnings({"UseOfSystemOutOrSystemErr", "ClassIndependentOfModule", "ClassOnlyUsedInOneModule"}) | ||
@SuppressWarnings({ "UseOfSystemOutOrSystemErr", "ClassIndependentOfModule", "ClassOnlyUsedInOneModule" }) | ||
enum CompareFiles { | ||
; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,14 +12,16 @@ | |
* | ||
* @author Daniel Tischner {@literal <[email protected]>} | ||
*/ | ||
@SuppressWarnings({"UseOfSystemOutOrSystemErr", "ClassIndependentOfModule", "ClassOnlyUsedInOneModule"}) | ||
@SuppressWarnings({ "UseOfSystemOutOrSystemErr", "ClassIndependentOfModule", "ClassOnlyUsedInOneModule" }) | ||
enum LocalChunkCache { | ||
; | ||
|
||
/** | ||
* Starts the application. | ||
* | ||
* @param args Two arguments, the path to the build and the path to the local chunk cache | ||
* | ||
* @throws IOException If an IOException occurred | ||
*/ | ||
public static void main(final String[] args) throws IOException { | ||
if (args.length != 2) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,51 +9,59 @@ | |
import java.util.*; | ||
import java.util.concurrent.atomic.AtomicLong; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
/** | ||
* Class offering a {@link #main(String[])} method that compares builds in a given folder with each other and creates | ||
* files with patch sizes. | ||
* | ||
* @author Daniel Tischner {@literal <[email protected]>} | ||
*/ | ||
@SuppressWarnings("UseOfSystemOutOrSystemErr") | ||
final class PatchBenchmark { | ||
@SuppressWarnings({ "UseOfSystemOutOrSystemErr", "MagicNumber" }) | ||
enum PatchBenchmark { | ||
; | ||
|
||
/** | ||
* Starts the application. | ||
* | ||
* @param args One arguments, the path to the builds to benchmark. | ||
* | ||
* @throws IOException If an IOException occurred | ||
*/ | ||
public static void main(final String[] args) throws IOException { | ||
if (args.length != 1) { | ||
throw new IllegalArgumentException( | ||
"Expected one arguments denoting the path to the folder containing the builds to benchmark."); | ||
} | ||
|
||
Path basePath = Path.of(args[0]); | ||
List<String> builds = Files.list(basePath) | ||
.filter(Files::isDirectory) | ||
.map(Path::getFileName) | ||
.map(Path::toString) | ||
.sorted() | ||
.collect(Collectors.toList()); | ||
final Path basePath = Path.of(args[0]); | ||
final List<String> builds; | ||
try (final Stream<Path> stream = Files.list(basePath)) { | ||
builds = stream.filter(Files::isDirectory) | ||
.map(Path::getFileName) | ||
.map(Path::toString) | ||
.sorted() | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
List<Map.Entry<String, String>> buildsToCompare = new ArrayList<>(); | ||
final List<Map.Entry<String, String>> buildsToCompare = new ArrayList<>(); | ||
for (int i = 0; i < builds.size() - 1; i++) { | ||
String previous = builds.get(i); | ||
String current = builds.get(i + 1); | ||
final String previous = builds.get(i); | ||
final String current = builds.get(i + 1); | ||
|
||
buildsToCompare.add(Map.entry(previous, current)); | ||
} | ||
|
||
System.out.printf("Comparing %d patch scenarios%n", buildsToCompare.size()); | ||
|
||
List<String> patchDataLines = new ArrayList<>(); | ||
final Collection<String> patchDataLines = new ArrayList<>(); | ||
patchDataLines.add("patch,name,fsc2mb,fastcdc2mb,fastcdc8kb"); | ||
// patchDataLines.add("patch,name,rtpal262kb"); | ||
List<String> buildDataLines = new ArrayList<>(); | ||
final Collection<String> buildDataLines = new ArrayList<>(); | ||
buildDataLines.add("version,name,size"); | ||
int i = 1; | ||
for (Map.Entry<String, String> comparison : buildsToCompare) { | ||
for (final Map.Entry<String, String> comparison : buildsToCompare) { | ||
//noinspection HardcodedFileSeparator | ||
System.out.printf("====================== %d / %d patch scenarios ======================%n", i, | ||
buildsToCompare.size()); | ||
|
||
|
@@ -76,11 +84,11 @@ public static void main(final String[] args) throws IOException { | |
comparison.getValue()); | ||
System.out.println(); | ||
|
||
List<Long> patchSizes = new ArrayList<>(); | ||
AtomicLong previousBuildSize = new AtomicLong(); | ||
AtomicLong currentBuildSize = new AtomicLong(); | ||
final Collection<Long> patchSizes = new ArrayList<>(); | ||
final AtomicLong previousBuildSize = new AtomicLong(); | ||
final AtomicLong currentBuildSize = new AtomicLong(); | ||
descriptionToChunker.forEach((description, chunker) -> { | ||
PatchSummary summary = PatchSummary.computePatchSummary(chunker, previousBuild, currentBuild); | ||
final PatchSummary summary = PatchSummary.computePatchSummary(chunker, previousBuild, currentBuild); | ||
|
||
patchSizes.add(summary.getPatchSize()); | ||
|
||
|
@@ -90,24 +98,22 @@ public static void main(final String[] args) throws IOException { | |
.getTotalSize()); | ||
}); | ||
|
||
StringJoiner patchSizesJoiner = new StringJoiner(","); | ||
final StringJoiner patchSizesJoiner = new StringJoiner(","); | ||
patchSizesJoiner.add(String.valueOf(i + 1)); | ||
patchSizesJoiner.add(previousBuild.getFileName() | ||
.toString() + "-" + currentBuild.getFileName() | ||
.toString()); | ||
patchSizesJoiner.add(previousBuild.getFileName() + "-" + currentBuild.getFileName()); | ||
patchSizes.forEach(size -> patchSizesJoiner.add(String.valueOf(size))); | ||
patchDataLines.add(patchSizesJoiner.toString()); | ||
|
||
if (i == 1) { | ||
StringJoiner buildDataJoiner = new StringJoiner(","); | ||
final StringJoiner buildDataJoiner = new StringJoiner(","); | ||
buildDataJoiner.add("1"); | ||
buildDataJoiner.add(previousBuild.getFileName() | ||
.toString()); | ||
buildDataJoiner.add(String.valueOf(previousBuildSize.get())); | ||
buildDataLines.add(buildDataJoiner.toString()); | ||
} | ||
|
||
StringJoiner buildDataJoiner = new StringJoiner(","); | ||
final StringJoiner buildDataJoiner = new StringJoiner(","); | ||
buildDataJoiner.add(String.valueOf(i + 1)); | ||
buildDataJoiner.add(currentBuild.getFileName() | ||
.toString()); | ||
|
@@ -116,8 +122,8 @@ public static void main(final String[] args) throws IOException { | |
|
||
i++; | ||
|
||
Path buildDataPath = Path.of("benchmark_build_data.csv"); | ||
Path patchDataPath = Path.of("benchmark_patch_data.csv"); | ||
final Path buildDataPath = Path.of("benchmark_build_data.csv"); | ||
final Path patchDataPath = Path.of("benchmark_patch_data.csv"); | ||
Files.write(buildDataPath, buildDataLines); | ||
Files.write(patchDataPath, patchDataLines); | ||
System.out.println("Updated benchmark build data: " + buildDataPath); | ||
|
Oops, something went wrong.