benchmark:Clear the first virtio-blk IO benchmark
This CL removes the first virtio-blk IO benchmark from the result list
as the first result may also include the data loading time from hard
drive to host. This is not part of the virtio-blk IO throughput.
Bug: 236123069
Test: atest MicrodroidBenchmarks
Change-Id: I383481ca3df2bbd7a6662e3e46251ac5c2eb3a9a
diff --git a/tests/benchmark/src/java/com/android/microdroid/benchmark/MicrodroidBenchmarks.java b/tests/benchmark/src/java/com/android/microdroid/benchmark/MicrodroidBenchmarks.java
index bb351c3..908da61 100644
--- a/tests/benchmark/src/java/com/android/microdroid/benchmark/MicrodroidBenchmarks.java
+++ b/tests/benchmark/src/java/com/android/microdroid/benchmark/MicrodroidBenchmarks.java
@@ -193,7 +193,13 @@
VirtualMachineConfig config = builder.debugLevel(DebugLevel.FULL).build();
List<Double> readRates = new ArrayList<>();
- for (int i = 0; i < VIRTIO_BLK_TRIAL_COUNT; ++i) {
+ for (int i = 0; i < VIRTIO_BLK_TRIAL_COUNT + 1; ++i) {
+ if (i == 1) {
+ // Clear the first result because when the file was loaded the first time,
+ // the data also needs to be loaded from hard drive to host. This is
+ // not part of the virtio-blk IO throughput.
+ readRates.clear();
+ }
String vmName = "test_vm_io_" + i;
mInner.forceCreateNewVirtualMachine(vmName, config);
VirtualMachine vm = mInner.getVirtualMachineManager().get(vmName);