Ejemplo n.º 1
0
        public void TestStartStop()
        {
            var pc = new PerfCounter();
            var rec = new DateTimeRecoder (new DateTime(1000), new DateTime(2000),
                new DateTime(3000), new DateTime(4000));
            pc.Now = rec.Now;
            pc.Start("testPC");
            pc.Start("testPC2");
            pc.Stop("testPC2");
            pc.Stop("testPC");

            Assert.AreEqual(0.0003, pc.GetStopWatch("testPC").Average, 0.00005);
            Assert.AreEqual(0.0001, pc.GetStopWatch("testPC2").Average, 0.00005);
        }
Ejemplo n.º 2
0
        public void DoBenchmark()
        {
            var solutionDir = @"../../../";
            var benchDir = solutionDir + "bench/";
            var outputDir = new DirectoryInfo(solutionDir + "test_tmp_result");
            CleanUp(outputDir);
            var bzipPath = benchDir + JA_HEAD_NAME;
            PerfCounter counter = new PerfCounter();
            counter.Start("AllBench");

            var outputDirDIC = DirectoryInfoCache.CreateRoot(outputDir);
            outputDirDIC.InterestedFilePattern = "*.wiki";
            outputDirDIC.SyncAllToFileSystem();

            var dumper = Dumper.CreateRawDumper(bzipPath, true, outputDirDIC, counter);
            // simulate split folder for large data
            SetupParameterForBenchMark(dumper);
            dumper._bzipReader.DecodeAsync();

            bzipPath = benchDir + "jatail.xml.bz2";
            dumper = Dumper.CreateRawDumper(bzipPath, true, outputDirDIC, counter);
            SetupParameterForBenchMark(dumper);
            dumper._bzipReader.DecodeAsync();

            counter.Stop("AllBench");
            if(EnableReport)
                Report(benchDir, counter);

            Console.WriteLine(counter.ToString());
        }