Skip to content

Commit

Permalink
Fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
alanpaxton committed Jan 7, 2025
1 parent 95d059c commit 1007e53
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions java/src/test/java/org/rocksdb/OpenFSyncPerformanceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,33 @@
* `make clean jclean; MACOS_IGNORE_FULLFSYNC=1 make -j12 rocksdbjava`
* The latter run this test about 10x faster on MacOS.
* @link <a href="https://github.com/facebook/rocksdb/issues/13147">...</a>
* `MACOS_IGNORE_FULLFSYNC` can be used to build fast test-only versions of RocksDB for efficient CI usage
* `MACOS_IGNORE_FULLFSYNC` can be used to build fast test-only versions of RocksDB for efficient CI
* usage
*/
public class OpenFSyncPerformanceTest {

@Test
public void testOpen() throws RocksDBException {
int count = 100;
ArrayList<Long> deltas = new ArrayList<>(count);
long sum = 0;
for (int i = 0; i < count; i++) {
long start = System.currentTimeMillis();
try(RocksDB db = RocksDB.open("test-open-" + i)) {
long delta = System.currentTimeMillis() - start;
//System.out.println("RocksDB.open() cost:" + (delta));
sum += delta;
deltas.add(delta);
} finally {
RocksDB.destroyDB("test-open-" +i, new Options());
}
}
long mean = sum / count;
long variance = 0;
for (long d : deltas) {
variance += (d - mean) * (d - mean);
}
double sd = Math.sqrt((double) (variance/count));
System.out.println("RocksDB.open() mean cost:" + (sum/count) + ", SD: " + sd + ", count: " + count);
@Test
public void testOpen() throws RocksDBException {
int count = 100;
ArrayList<Long> deltas = new ArrayList<>(count);
long sum = 0;
for (int i = 0; i < count; i++) {
long start = System.currentTimeMillis();
try (RocksDB db = RocksDB.open("test-open-" + i)) {
long delta = System.currentTimeMillis() - start;
// System.out.println("RocksDB.open() cost:" + (delta));
sum += delta;
deltas.add(delta);
} finally {
RocksDB.destroyDB("test-open-" + i, new Options());
}
}
long mean = sum / count;
long variance = 0;
for (long d : deltas) {
variance += (d - mean) * (d - mean);
}
double sd = Math.sqrt((double) (variance / count));
System.out.println(
"RocksDB.open() mean cost:" + (sum / count) + ", SD: " + sd + ", count: " + count);
}
}

0 comments on commit 1007e53

Please sign in to comment.