]> granicus.if.org Git - libjpeg-turbo/commitdiff
Java TJBench: Fix parsing of -warmup argument
authorDRC <information@libjpeg-turbo.org>
Wed, 28 Jun 2017 19:40:35 +0000 (14:40 -0500)
committerDRC <information@libjpeg-turbo.org>
Wed, 28 Jun 2017 20:22:32 +0000 (15:22 -0500)
Due to an oversight, this wasn't included in
1db1ce45da2e78d87ff05119b674c71d630926aa.

java/TJBench.java

index 415d8e1bd0f56c3fa9f4f11edd1abdc15790f6b8..5185d6585d2351dc40e95b517480e5fea2f3a6f8 100644 (file)
@@ -834,14 +834,15 @@ class TJBench {
           if (argv[i].equalsIgnoreCase("-nowrite"))
             write = false;
           if (argv[i].equalsIgnoreCase("-warmup") && i < argv.length - 1) {
-            int temp = -1;
+            double temp = -1;
             try {
-             temp = Integer.parseInt(argv[++i]);
+             temp = Double.parseDouble(argv[++i]);
             } catch (NumberFormatException e) {}
-            if (temp >= 0) {
+            if (temp >= 0.0) {
               warmup = temp;
-              System.out.format("Warmup runs = %d\n\n", warmup);
-            }
+              System.out.format("Warmup time = %.1f seconds\n\n", warmup);
+            } else
+              usage();
           }
           if (argv[i].equalsIgnoreCase("-?"))
             usage();