예제 #1
0
        static TimeSpan Time <T>(Func <ISodaQueryFactory, IEnumerable <T> > query)
        {
            var queryFactory = new NullSodaQueryFactory();
            var stopWatch    = new StopWatch();

            stopWatch.Start();

            for (int i = 0; i < 100000; ++i)
            {
                Assert.AreEqual(0, query(queryFactory).Count());
            }

            stopWatch.Stop();
            return(stopWatch.Elapsed());
        }
예제 #2
0
파일: IoBenchmark.cs 프로젝트: yuuhhe/db4o
        /// <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);
        }
예제 #3
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);
        }