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; }
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); } }
void LocalIncludeCache_FinishedParsing(ParsePerformanceData[] PerformanceData) { analysisFinished_LocalIncludes = true; TryBuildUfcsCache(); }
void LocalFileCache_FinishedParsing(ParsePerformanceData[] PerformanceData) { analysisFinished_LocalCache = true; _InsertFileLinkModulesIntoLocalCache(); TryBuildUfcsCache(); }
void GlobalParseCache_FinishedParsing(ParsePerformanceData[] PerformanceData) { analysisFinished_GlobalCache = true; TryBuildUfcsCache(); }
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)); }
void analysisDone(ParsePerformanceData[] pfd) { ManagedProject.ParsedModules.FinishedParsing -= analysisDone; Dispatcher.Invoke(new Action(()=>button_ReparsePrjDirectory.IsEnabled=true)); }
void finishedProjectModuleAnalysis(ParsePerformanceData[] pfd) { localCacheAnalysisFinished = true; if (globalCacheAnalysisFinished || !CompilerConfiguration.ASTCache.IsParsing) BuildUfcsCache(); ParsedModules.FinishedParsing -= finishedProjectModuleAnalysis; DEditorDocument.UpdateSemanticHighlightings(true); }
void finishedCmpCacheAnalysis(ParsePerformanceData[] pfd) { if (localCacheAnalysisFinished) BuildUfcsCache(); else globalCacheAnalysisFinished = true; }