Exemplo n.º 1
0
        public bool LoadCacheGraph(string cachedGraphDirectory)
        {
            if (string.IsNullOrEmpty(cachedGraphDirectory) && string.IsNullOrEmpty(ExecutionLogPath))
            {
                return(false);
            }

            // Dummy logger that nothing listens to but is needed for cached graph API
            LoggingContext loggingContext = new LoggingContext("BuildXL.Execution.Analyzer");

            CachedGraphDirectory = !string.IsNullOrWhiteSpace(cachedGraphDirectory)
                ? cachedGraphDirectory
                : Path.Combine(Path.GetDirectoryName(ExecutionLogPath), Path.GetFileNameWithoutExtension(ExecutionLogPath));

            using (ConsoleEventListener listener = new ConsoleEventListener(Events.Log, DateTime.UtcNow,
                                                                            eventMask: new EventMask(
                                                                                enabledEvents: null,
                                                                                disabledEvents: new int[]
            {
                (int)BuildXL.Engine.Tracing.LogEventId.DeserializedFile,         // Don't log anything for success
            })
                                                                            ))
            {
                listener.RegisterEventSource(BuildXL.Engine.ETWLogger.Log);
                CachedGraph = CachedGraph.LoadAsync(CachedGraphDirectory, loggingContext, preferLoadingEngineCacheInMemory: true, readStreamProvider: StreamProvider).GetAwaiter().GetResult();
            }
            if (CachedGraph == null)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        protected async Task <CachedGraph> GetCachedGraphAsync(string buildId)
        {
            var loggingContext = new LoggingContext("Website");
            var invocations    = new Invocations().GetInvocations(loggingContext);
            var thisInvocation = invocations.First(invocation => invocation.SessionId == buildId);

            var entry = await Cache.GetOrCreateAsync(
                "CachedGraph: =" + buildId,
                (newEntry) => CachedGraph.LoadAsync(
                    Path.Combine(thisInvocation.LogsFolder, "BuildXL"),
                    loggingContext,
                    true
                    ));

            return(entry);
        }
Exemplo n.º 3
0
        public bool LoadCacheGraph(string cachedGraphDirectory)
        {
            if (string.IsNullOrEmpty(cachedGraphDirectory) && string.IsNullOrEmpty(ExecutionLogPath))
            {
                return(false);
            }

            // Dummy logger that nothing listens to but is needed for cached graph API
            LoggingContext loggingContext = new LoggingContext("BuildXL.Execution.Analyzer");

            CachedGraphDirectory = !string.IsNullOrWhiteSpace(cachedGraphDirectory)
                ? cachedGraphDirectory
                : Path.Combine(Path.GetDirectoryName(ExecutionLogPath), Path.GetFileNameWithoutExtension(ExecutionLogPath));

            CachedGraph = CachedGraph.LoadAsync(CachedGraphDirectory, loggingContext, preferLoadingEngineCacheInMemory: true, readStreamProvider: StreamProvider).GetAwaiter().GetResult();

            if (CachedGraph == null)
            {
                return(false);
            }

            return(true);
        }