Skip to content

Commit

Permalink
add benchmark to consistency test
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbooks committed May 2, 2019
1 parent f5ac2de commit 0e95612
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion test/src/org/josh/JoshDB/FileTrie/ConsistencyTest.java
Expand Up @@ -439,7 +439,7 @@ public void testReadWriteMetadataConsistency()


for (int i = 0; i < testArray.length; i++) for (int i = 0; i < testArray.length; i++)
{ {
testArray[i] = new byte[random.nextInt(0x10000)]; testArray[i] = new byte[0x10000];
random.nextBytes(testArray[i]); random.nextBytes(testArray[i]);
} }


Expand Down Expand Up @@ -505,6 +505,8 @@ public void testReadWriteMetadataConsistency()
readSucesses[i] = false; readSucesses[i] = false;
} }


long startTime = System.nanoTime();

startAndJoinThreads startAndJoinThreads
( (
testArray.length, testArray.length,
Expand Down Expand Up @@ -572,6 +574,22 @@ public void testReadWriteMetadataConsistency()
} }
); );


long endTime = System.nanoTime();

System
.out
.println
(
"It took "
+ (endTime - startTime)
+ " nanoseconds"
+ " to read "
+ testArray.length
+ " objects, each "
+ testArray[0].length
+ " bytes long"
);

boolean globalSuccess = true; boolean globalSuccess = true;
for (int i = 0; i < readSucesses.length; i++) for (int i = 0; i < readSucesses.length; i++)
{ {
Expand Down

0 comments on commit 0e95612

Please sign in to comment.