static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage: NetworkReaderBenchmark <path-to-MST>"); return; } string connectionString = args[0]; try { IrbisEncoding.RelaxUtf8(); Console.WriteLine("Open"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); using (IrbisConnection connection = new IrbisConnection(connectionString)) { int maxMfn = connection.GetMaxMfn(); Console.WriteLine("Max MFN={0}", maxMfn); IEnumerable <MarcRecord> batch = BatchRecordReader.WholeDatabase ( connection, connection.Database, 1000, reader => { Console.Write('.'); } ); foreach (MarcRecord record in batch) { if (record.Modified) { Console.WriteLine("Very strange!"); } } } stopwatch.Stop(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Close"); Console.WriteLine ( "Elapsed: {0} sec", stopwatch.Elapsed.ToSecondString() ); } catch (Exception exception) { Console.WriteLine(exception); } }
static void Main(string[] args) { if (args.Length != 2) { Console.WriteLine("Usage: FormatBenchmark <rootPath> <format>"); return; } string rootPath = args[0]; string format = args[1]; try { IrbisEncoding.RelaxUtf8(); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); using (LocalProvider provider = new LocalProvider(rootPath)) { provider.Database = "IBIS"; int maxMfn = provider.GetMaxMfn(); Console.WriteLine("Max MFN={0}", maxMfn); PftContext context = new PftContext(null); context.SetProvider(provider); PftFormatter formatter = new PftFormatter(context); formatter.ParseProgram(format); for (int mfn = 1; mfn <= maxMfn; mfn++) { MarcRecord record = provider.ReadRecord(mfn); if (ReferenceEquals(record, null)) { continue; } string text = formatter.FormatRecord(record); Console.WriteLine(text); } } stopwatch.Stop(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine ( "Elapsed: {0} sec", stopwatch.Elapsed.ToSecondString() ); } catch (Exception exception) { Console.WriteLine(exception); } }
static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage: ParseBenchmark <format>"); return; } string formatFile = args[0]; string programText = File.ReadAllText(formatFile, IrbisEncoding.Ansi); try { IrbisEncoding.RelaxUtf8(); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); using (NullProvider provider = new NullProvider()) { provider.Database = "IBIS"; PftContext context = new PftContext(null); context.SetProvider(provider); for (int i = 0; i < 10000; i++) { PftFormatter formatter = new PftFormatter(context); formatter.ParseProgram(programText); } } stopwatch.Stop(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine ( "Elapsed: {0} sec", stopwatch.Elapsed.ToSecondString() ); } catch (Exception exception) { Console.WriteLine(exception); } }
static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage: DirectReaderBenchmark <path-to-MST>"); return; } string masterPath = args[0]; try { IrbisEncoding.RelaxUtf8(); Console.WriteLine("Open: {0}", masterPath); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); using (DirectAccess64 reader = new DirectAccess64(masterPath)) { int maxMfn = reader.GetMaxMfn(); Console.WriteLine("Max MFN={0}", maxMfn); Parallel.For ( 1, maxMfn, mfn => { try { MarcRecord record = reader.ReadRecord(mfn); //Console.Write('.'); if (!ReferenceEquals(record, null)) { Debug.Assert(record.Mfn == mfn); } } catch (Exception exception) { Console.WriteLine ( "MFN={0}: exception: {1}", mfn, exception ); } } ); } stopwatch.Stop(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Close: {0}", masterPath); Console.WriteLine ( "Elapsed: {0} sec", stopwatch.Elapsed.ToSecondString() ); } catch (Exception exception) { Console.WriteLine(exception); } }
static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("USAGE: IrbisTestRunner <config.json> [testToRun]"); return; } IrbisEncoding.RelaxUtf8(); TestRunner engine = null; string testToRun = null; if (args.Length > 1) { testToRun = args[1]; } try { engine = new TestRunner(); string configFileName = args[0]; engine.LoadConfig(configFileName); engine.Verify(true); if (!engine.ForeignServer && engine.FindLocalServer()) { engine.WriteLine ( ConsoleColor.Red, "Server already running" ); return; } engine.StartServer(); engine.HideServerWindow(); engine.PingTheServer(); engine.DiscoverTests(); engine.CompileTests(); engine.RunTests(testToRun); } catch (Exception ex) { Console.Error.WriteLine(ex); } finally { if (!ReferenceEquals(engine, null)) { engine.StopServer(); } } if (!ReferenceEquals(engine, null)) { engine.PrintReport(); } }