public static ParsePerformanceData Parse(string directory, RootPackage rootPackage)
        {
            var ppd = new ParsePerformanceData { BaseDirectory = directory };

            /*
             * 1) List all files
             * 2) Create module packages
             * 3) Enlist all file-package pairs in the queue
             * 4) Start parse threads
             * 5) Wait for all to join
             */

            var tpd = new ThreadedDirectoryParser
            {
                baseDirectory = directory
            };

            // 1), 2), 3)
            tpd.PrepareQueue(rootPackage);

            ppd.AmountFiles = tpd.queue.Count;
            var sw = new Stopwatch();
            sw.Start();

            // 4)
            var threads = new Thread[numThreads];
            for (int i = 0; i < numThreads; i++)
            {
                var th = threads[i] = new Thread(tpd.ParseThread) {
                    IsBackground = true,
                    Priority= ThreadPriority.Lowest,
                    Name = "Parser thread #"+i+" ("+directory+")"
                };
                th.Start();
            }

            // 5)
            for (int i = 0; i < numThreads; i++)
                if (threads[i].IsAlive)
                    threads[i].Join(10000);

            sw.Stop();
            ppd.TotalDuration = sw.Elapsed.TotalSeconds;

            return ppd;
        }
示例#2
0
        void parsedSources(ParsePerformanceData[] pfd)
        {
            // Output parse time stats
            if (pfd != null)
                foreach (var ppd in pfd)
                    ErrorLogger.Log("Parsed " + ppd.AmountFiles + " files in " +
                        ppd.BaseDirectory + " in " +
                        Math.Round(ppd.TotalDuration, 2).ToString() + "s (~" +
                        Math.Round(ppd.FileDuration, 3).ToString() + "s per file)",
                        ErrorType.Information, ErrorOrigin.Parser);

            // For debugging purposes dump all parse results (errors etc.) to a log file.
            try
            {
                ParseLog.Write(ASTCache, IDEInterface.ConfigDirectory + "\\" + Version.ToString() + ".GlobalParseLog.log");
            }
            catch (Exception ex)
            {
                ErrorLogger.Log(ex, ErrorType.Warning, ErrorOrigin.System);
            }
        }
示例#3
0
 void LocalIncludeCache_FinishedParsing(ParsePerformanceData[] PerformanceData)
 {
     analysisFinished_LocalIncludes = true;
     TryBuildUfcsCache();
 }
示例#4
0
 void LocalFileCache_FinishedParsing(ParsePerformanceData[] PerformanceData)
 {
     analysisFinished_LocalCache = true;
     _InsertFileLinkModulesIntoLocalCache();
     TryBuildUfcsCache();
 }
示例#5
0
 void GlobalParseCache_FinishedParsing(ParsePerformanceData[] PerformanceData)
 {
     analysisFinished_GlobalCache = true;
     TryBuildUfcsCache();
 }
示例#6
0
        void finishedParsing(ParsePerformanceData[] pfd)
        {
            foreach (var perfData in pfd)
            {
                LoggingService.LogInfo(
                    "Parsed {0} files in \"{1}\" in {2}s (~{3}ms per file)",
                    perfData.AmountFiles,
                    perfData.BaseDirectory,
                    Math.Round(perfData.TotalDuration, 3),
                    Math.Round(perfData.FileDuration * 1000));
            }

            if (ParseCache.LastParseException != null)
                LoggingService.LogError("Error while updating parse cache", ParseCache.LastParseException);
        }
 void finishedAnalysis(ParsePerformanceData[] pfd)
 {
     cfg.ASTCache.FinishedParsing -= finishedAnalysis;
     Dispatcher.Invoke(new Action(() => Cursor = Cursors.Arrow));
 }
示例#8
0
 void analysisDone(ParsePerformanceData[] pfd)
 {
     ManagedProject.ParsedModules.FinishedParsing -= analysisDone;
     Dispatcher.Invoke(new Action(()=>button_ReparsePrjDirectory.IsEnabled=true));
 }
示例#9
0
        void finishedProjectModuleAnalysis(ParsePerformanceData[] pfd)
        {
            localCacheAnalysisFinished = true;

            if (globalCacheAnalysisFinished || !CompilerConfiguration.ASTCache.IsParsing)
                BuildUfcsCache();

            ParsedModules.FinishedParsing -= finishedProjectModuleAnalysis;

            DEditorDocument.UpdateSemanticHighlightings(true);
        }
示例#10
0
 void finishedCmpCacheAnalysis(ParsePerformanceData[] pfd)
 {
     if (localCacheAnalysisFinished)
         BuildUfcsCache();
     else
         globalCacheAnalysisFinished = true;
 }