@@ -105,6 +105,10 @@ public static void removeDb() {
105105 FileUtil .deleteDir (new File (dbPath ));
106106 }
107107
108+ private static int randomInt (int minInt , int maxInt ) {
109+ return (int ) Math .round (Math .random () * (maxInt - minInt ) + minInt );
110+ }
111+
108112 @ Test
109113 public void testLibsodium () throws ZksnarkException {
110114 byte [] K = new byte [32 ];
@@ -259,6 +263,36 @@ public long benchmarkVerifySpend() throws ZksnarkException {
259263 return time ;
260264 }
261265
266+
267+ @ Test
268+ public void calBenchmarkbenchmarkVerifySpend () throws ZksnarkException {
269+ librustzcashInitZksnarkParams ();
270+ System .out .println ("--- load ok ---" );
271+
272+ int count = 10 ;
273+ long min_time = 500 ;
274+ long max_time = 0 ;
275+ double total_time = 0.0 ;
276+
277+ for (int i = 0 ; i < count ; i ++) {
278+ long time = benchmarkVerifySpend ();
279+ if (time < min_time ) {
280+ min_time = time ;
281+ }
282+ if (time > max_time ) {
283+ max_time = time ;
284+ }
285+ total_time += time ;
286+ }
287+
288+ System .out .println ("---- result ----" );
289+ System .out .println ("---- max_time is: " + max_time );
290+ System .out .println ("---- min_time is: " + min_time );
291+ System .out .println ("---- avg_time is: " + total_time / count );
292+
293+ }
294+
295+
262296 public long benchmarkCreateSpend () throws ZksnarkException {
263297
264298 long ctx = librustzcashSaplingProvingCtxInit ();
@@ -307,7 +341,7 @@ public void calBenchmarkSpendConcurrent() throws Exception{
307341 librustzcashInitZksnarkParams ();
308342 System .out .println ("--- load ok ---" );
309343
310- int count = 100 ;
344+ int count = 10 ;
311345
312346 CountDownLatch countDownLatch = new CountDownLatch (count );
313347
@@ -349,7 +383,7 @@ public void calBenchmarkSpend() throws ZksnarkException {
349383 librustzcashInitZksnarkParams ();
350384 System .out .println ("--- load ok ---" );
351385
352- int count = 100 ;
386+ int count = 10 ;
353387 long min_time = 10000 ;
354388 long max_time = 0 ;
355389 double total_time = 0.0 ;
@@ -398,7 +432,7 @@ public void calBenchmarkVerifyOutput() throws ZksnarkException {
398432 librustzcashInitZksnarkParams ();
399433 System .out .println ("--- load ok ---" );
400434
401- int count = 100 ;
435+ int count = 10 ;
402436 long min_time = 500 ;
403437 long max_time = 0 ;
404438 double total_time = 0.0 ;
@@ -588,7 +622,7 @@ public void checkVerifyOutErr() throws ZksnarkException {
588622 @ Test
589623 public void testGenerateNote () throws Exception {
590624
591- int total = 100 ;
625+ int total = 10 ;
592626 int success = 0 ;
593627 int fail = 0 ;
594628
@@ -634,7 +668,7 @@ public void testGenerateNote() throws Exception {
634668 @ Test
635669 public void testGenerateNoteWithDefault () throws Exception {
636670
637- int total = 1000 ;
671+ int total = 10 ;
638672 int success = 0 ;
639673 int fail = 0 ;
640674
0 commit comments