From 1b854d99416b50be2f4c68e32e00ffc55c35a8e3 Mon Sep 17 00:00:00 2001 From: MichaelThomas-1 <greeman2.9@gmail.com> Date: Fri, 23 Oct 2020 15:18:40 +1100 Subject: [PATCH] Updated test counter - File includes timestamp for use in determining which batch it belongs to - Removed old runCount.txt file --- fuzzer/Fuzzer.java | 9 +++++++++ runCount.txt | 0 2 files changed, 9 insertions(+) delete mode 100644 runCount.txt diff --git a/fuzzer/Fuzzer.java b/fuzzer/Fuzzer.java index caf44ca..9e42f76 100644 --- a/fuzzer/Fuzzer.java +++ b/fuzzer/Fuzzer.java @@ -37,6 +37,8 @@ public class Fuzzer { private static final int VAR_MAX = 2147483647; // Maximum number of items in stack private static final int MAX_STACK_SIZE = 512; + // Maxiumum time difference for different executions to be counted as apart of the same batch of tests + private static final long MAX_TIME_DIFF = 5000; // Should be 5 seconds // Random number generator private static Random rand = new Random(System.currentTimeMillis()); @@ -82,9 +84,14 @@ public class Fuzzer { private static int getRun(){ int runCount = 0; + long curTime = System.currentTimeMillis(); try { Scanner input = new Scanner(new File("runCount.txt")); runCount = input.nextInt() + 1; + long runTime = input.nextLong(); + if (curTime - runTime > MAX_TIME_DIFF) { + runCount = 0; + } } catch (Exception e){ // Carry on } @@ -100,6 +107,8 @@ public class Fuzzer { pw = new PrintWriter(out); pw.print(runCount); + pw.print(" "); + pw.print(System.currentTimeMillis()); }catch (Exception e){ e.printStackTrace(System.err); diff --git a/runCount.txt b/runCount.txt deleted file mode 100644 index e69de29..0000000 -- GitLab