Beispiel #1
0
        /// <exception cref="IOException"></exception>
        private void BenchmarkCommand(string command, int itemCount, string dbFileName, TextWriter@out)
        {
            var   commands    = CommandSet(command);
            IBin  bin         = Bin(dbFileName);
            var   replayer    = new LogReplayer(CrudApplication.LogFileName(itemCount), bin, commands);
            List4 commandList = replayer.ReadCommandList();
            var   watch       = new StopWatch();

            watch.Start();
            replayer.PlayCommandList(commandList);
            watch.Stop();
            bin.Close();

            var timeElapsed    = watch.Elapsed();
            var operationCount = ((long)replayer.OperationCounts()[command]);

            PrintStatisticsForCommand(@out, command, timeElapsed, operationCount);
        }
Beispiel #2
0
        /// <exception cref="IOException"></exception>
        private void BenchmarkCommand(string command, int itemCount, string dbFileName, TextWriter
                                      @out)
        {
            HashSet commands = CommandSet(command);

            Db4objects.Db4o.IO.IoAdapter io = IoAdapter(dbFileName);
            LogReplayer replayer            = new LogReplayer(CrudApplication.LogFileName(itemCount), io
                                                              , commands);
            List4     commandList = replayer.ReadCommandList();
            StopWatch watch       = new StopWatch();

            watch.Start();
            replayer.PlayCommandList(commandList);
            watch.Stop();
            io.Close();
            long timeElapsed    = watch.Elapsed();
            long operationCount = ((long)replayer.OperationCounts()[command]);

            PrintStatisticsForCommand(@out, command, timeElapsed, operationCount);
        }
Beispiel #3
0
        private void PrepareDbFile(int itemCount)
        {
            Sysout("Preparing DB file ...");
            DeleteFile(_dbFileName);
            var         storage  = new FileStorage();
            var         bin      = storage.Open(new BinConfiguration(_dbFileName, false, 0, false));
            LogReplayer replayer = new LogReplayer(CrudApplication.LogFileName(itemCount), bin);

            try
            {
                replayer.ReplayLog();
            }
            catch (IOException ex)
            {
                ExitWithError("Error reading I/O operations log file " + ex);
            }
            finally
            {
                bin.Close();
            }
        }
Beispiel #4
0
        private void PrepareDbFile(int itemCount)
        {
            Sysout("Preparing DB file ...");
            DeleteFile(_dbFileName);
            Db4objects.Db4o.IO.IoAdapter rafFactory = new RandomAccessFileAdapter();
            Db4objects.Db4o.IO.IoAdapter raf        = rafFactory.Open(_dbFileName, false, 0, false);
            LogReplayer replayer = new LogReplayer(CrudApplication.LogFileName(itemCount), raf
                                                   );

            try
            {
                replayer.ReplayLog();
            }
            catch (IOException)
            {
                ExitWithError("Error reading I/O operations log file");
            }
            finally
            {
                raf.Close();
            }
        }
Beispiel #5
0
 private void DeleteCrudLogFile(int itemCount)
 {
     DeleteFile(CrudApplication.LogFileName(itemCount));
 }