/** * @param args */ #pragma warning disable 219 public static void main(string[] args) { FileStream fs = null; BufferedStream bs = null; BinaryReader br = null; long heapsize = 0; // Prints credits System.Console.WriteLine("BeepBeep Trace Validator, version 0.9.3"); System.Console.WriteLine("(C) 2007-2012 Sylvain Halle, UQAM/UCSB"); if (args.Length < 2) { System.Console.Error.WriteLine("ERROR: wrong command line parameters"); return; } // Parses arguments string inputFilename = args[0]; string queryFilename = args[1]; // Gets property to check string formula = readProperty(queryFilename); if (formula == null) { System.Console.Error.WriteLine("ERROR: cannot open " + queryFilename); return; } // Parses property to check Operator property = LTLStringParser.parseFromString(formula); if (property == null) { System.Console.Error.WriteLine("ERROR: invalid property"); return; } // Opens file //StreamReader traceFile = File.OpenText(inputFilename); try { //fs = new FileStream(traceFile, FileAccess.ReadWrite); fs = new FileStream(inputFilename, FileMode.Open); bs = new BufferedStream(fs); br = new BinaryReader(bs); } catch (FileNotFoundException e) { System.Console.Error.WriteLine("ERROR: cannot open " + inputFilename); return; } // A: here, br points to a valid, opened trace file // Start stopwatch long timeBegin = Stopwatch.GetTimestamp(); SymbolicWatcher w = new SymbolicWatcher(); w.setFormula(property); // Start processing the trace long numMessages = 0; string message = getNextMessage(br); while (message != null) { numMessages++; w.update(message); message = getNextMessage(br); //heapsize = Mathf.Max(heapsize, RuntimeGenerator. } // Stop stopwatch long timeEnd = Stopwatch.GetTimestamp(); // Processing is over, get stats... int milliseconds = (int)((timeEnd - timeBegin) / (float)100000); string outcome = "INCONCLUSIVE"; Outcome oOut = w.getOutcome(); if (oOut == Outcome.TRUE) { outcome = "TRUE"; } else if (oOut == Outcome.FALSE) { outcome = "FALSE"; } int maxNodes = w.getMaxNodes(); int maxSize = w.getMaxSize(); int maxAtoms = w.getMaxAtoms(); System.Console.WriteLine("Messages: " + numMessages); System.Console.WriteLine("Outcome: " + outcome); System.Console.WriteLine("Max nodes: " + maxNodes); System.Console.WriteLine("Max size: " + maxSize); System.Console.WriteLine("Max atoms: " + maxAtoms); System.Console.WriteLine("Time (ms): " + milliseconds); System.Console.WriteLine("Max heap: " + heapsize); try { if (br != null) { br.Close(); } if (bs != null) { bs.Close(); } if (fs != null) { fs.Close(); } } catch (IOException e) { System.Console.Error.WriteLine("ERROR: while closing trace file"); return; } }