Esempio n. 1
0
 private void Report(string benchDir, PerfCounter counter)
 {
     var csvPath = benchDir + RESULT_CSV_NAME;
     var tmpPath = benchDir + "result_tmp.csv";
     using (var input = new StreamReader(csvPath))
     {
         using (var output = new StreamWriter(tmpPath))
         {
             output.Write(input.ReadToEnd());
             var bldr = new StringBuilder();
             bldr.Append(DateTime.Now.ToString("yyyy/MM/dd HH:mm"));
             bldr.Append(",");
             bldr.AppendFormat(" {0:0.00}", counter.GetTotalSeconds("AllBench"));
             bldr.Append(",");
             bldr.AppendFormat(" {0:0.00}", counter.GetTotalSeconds("LocateBlock"));
             bldr.Append(",");
             bldr.AppendFormat(" {0:0.00}", counter.GetTotalSeconds("LoadBlock"));
             bldr.Append(",");
             bldr.AppendFormat(" {0:0.00}", counter.GetTotalSeconds("Action"));
             bldr.Append(",");
             bldr.AppendFormat(" {0:0.00}", counter.GetTotalSeconds("Split"));
             bldr.Append(",");
             bldr.AppendFormat(" {0:0.00}", counter.GetTotalSeconds("GetYomi"));
             bldr.Append(",");
             bldr.AppendFormat(" {0:0.00}", counter.GetTotalSeconds("Other"));
             bldr.Append(", "); // for comment field.
             output.WriteLine(bldr.ToString());                        
         }
     }
     var fi = new FileInfo(csvPath);
     fi.Delete();
     fi = new FileInfo(tmpPath);
     fi.MoveTo(csvPath);
 }
Esempio n. 2
0
 public Dumper(string bzipPath, DumpAction act, PerfCounter counter)
 {
     _action = act;
     _bzipReader = new BzipReader(bzipPath, _action, counter);
     _action.Decoder = _bzipReader;
     _action._notify = _bzipReader;
 }
Esempio n. 3
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());
        }
Esempio n. 4
0
 public Dumper(string bzipPath, DumpAction act, PerfCounter counter)
 {
     _action         = act;
     _bzipReader     = new BzipReader(bzipPath, _action, counter);
     _action.Decoder = _bzipReader;
     _action._notify = _bzipReader;
 }
Esempio n. 5
0
 public static Dumper CreateHtmlGenerater(string bzipPath, bool isJapanese, DirectoryInfoCache result, PerfCounter counter)
 {
     DumpAction htmlAction = DumpAction.CreateHtmlGeneraterAction(bzipPath, result.Item);
     var dumper = new Dumper(bzipPath, htmlAction, counter);
     SplitFolder sf = CreateSplitFolder(isJapanese, result);
     PostCreate(dumper, isJapanese, sf);
     return dumper;
 }
Esempio n. 6
0
        public ProgressDialog(ILongTask indexer, PerfCounter counter)
        {
            _counter = counter;
            InitializeComponent();

            ltask = indexer;

            ltask.ProgressChanged += new ProgressChangedEventHandler(ixr_ProgressChanged);
        }
Esempio n. 7
0
        public ProgressDialog(ILongTask indexer, PerfCounter counter)
        {
            _counter = counter;
            InitializeComponent();

            ltask = indexer;

            ltask.ProgressChanged += new ProgressChangedEventHandler(ixr_ProgressChanged);
        }
Esempio n. 8
0
 public static Dumper CreateRawDumper(string bzipPath, bool isJapanese, DirectoryInfoCache result, PerfCounter counter)
 {
     DumpAction rawDump = DumpAction.CreateRawDumpAction(bzipPath, result.Item);
     Dumper dumper =  new Dumper(bzipPath, rawDump, counter);
     SplitFolder sf = CreateSplitFolder(isJapanese, result);
     // not DRY!
     sf.InterestedFilePattern = "*.wiki";
     PostCreate(dumper, isJapanese, sf);
     return dumper;
 }
Esempio n. 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BzipReader"/> class.
        /// </summary>
        /// <param name="path">The path to the .xml.bz2 dump of wikipedia</param>
        public BzipReader(string path, IDecodedAction action, PerfCounter counter)
        {
            filePath = path;
            _action  = action;
            Counter  = counter;

            multithreadedIndexing = (Environment.ProcessorCount > 1);
            abortDecoding         = false;
            EnableYomi            = false;
            EnableAutoLogging     = false;
        }
Esempio n. 10
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);
        }
Esempio n. 11
0
 public ProfileDialog(PerfCounter counter)
 {
     _counter = counter;
     InitializeComponent();
     UpdateTextBox();
 }
Esempio n. 12
0
 public ProfileDialog(PerfCounter counter)
 {
     _counter = counter;
     InitializeComponent();
     UpdateTextBox();
 }
Esempio n. 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BzipReader"/> class.
        /// </summary>
        /// <param name="path">The path to the .xml.bz2 dump of wikipedia</param>
        public BzipReader(string path, IDecodedAction action, PerfCounter counter)
        {
            filePath = path;
            _action = action;
            Counter = counter;

            multithreadedIndexing = (Environment.ProcessorCount > 1);
            abortDecoding = false;
            EnableYomi = false;
            EnableAutoLogging = false;
        }
Esempio n. 14
0
        public static Dumper CreateRawDumper(string bzipPath, bool isJapanese, DirectoryInfoCache result, PerfCounter counter)
        {
            DumpAction  rawDump = DumpAction.CreateRawDumpAction(bzipPath, result.Item);
            Dumper      dumper  = new Dumper(bzipPath, rawDump, counter);
            SplitFolder sf      = CreateSplitFolder(isJapanese, result);

            // not DRY!
            sf.InterestedFilePattern = "*.wiki";
            PostCreate(dumper, isJapanese, sf);
            return(dumper);
        }
Esempio n. 15
0
        public static Dumper CreateHtmlGenerater(string bzipPath, bool isJapanese, DirectoryInfoCache result, PerfCounter counter)
        {
            DumpAction  htmlAction = DumpAction.CreateHtmlGeneraterAction(bzipPath, result.Item);
            var         dumper     = new Dumper(bzipPath, htmlAction, counter);
            SplitFolder sf         = CreateSplitFolder(isJapanese, result);

            PostCreate(dumper, isJapanese, sf);
            return(dumper);
        }