Example #1
0
 private PipReference[] GetPipsForExecutionLevel(string level)
 {
     return(PipGraph
            .RetrievePipReferencesOfType(PipType.Process)
            .Where(pipRef => GetPipExecutionLevel(pipRef.PipId) == level)
            .ToArray());
 }
Example #2
0
        /// <nodoc />
        public XlgDebuggerState(DebugLogsAnalyzer analyzer)
            : base(XlgThreadId)
        {
            Analyzer = analyzer;

            var logFile = Path.Combine(Path.GetDirectoryName(Analyzer.Input.ExecutionLogPath), "BuildXL.status.csv");

            StackTrace = new[]
            {
                new DisplayStackTraceEntry(file: logFile, line: 1, position: 1, functionName: "<main>", entry: null)
            };

            PipsByType = Enum
                         .GetValues(typeof(PipType))
                         .Cast <PipType>()
                         .Except(new[] { PipType.Max })
                         .Aggregate(new ObjectInfoBuilder(), (obi, pipType) => obi.Prop(pipType.ToString(), () => PipGraph.RetrievePipReferencesOfType(pipType).ToArray()))
                         .Build();

            PipsByStatus = Enum
                           .GetValues(typeof(PipExecutionLevel))
                           .Cast <PipExecutionLevel>()
                           .Select(level => level.ToString())
                           .Concat(new[] { ExeLevelNotCompleted })
                           .Aggregate(new ObjectInfoBuilder(), (obi, levelStr) => obi.Prop(levelStr, () => GetPipsForExecutionLevel(levelStr)))
                           .Build();

            RootObject = new ObjectInfoBuilder()
                         .Preview("Root")
                         .Prop("Pips", () => PipGraph.RetrieveAllPips())
                         .Prop("ProcessPips", () => PipGraph.RetrievePipReferencesOfType(PipType.Process))
                         .Prop("Files", () => PipGraph.AllFiles)
                         .Prop("Directories", () => PipGraph.AllSealDirectories)
                         .Prop("DirMembership", () => Analyzer.GetDirMembershipData())
                         //.Prop("CriticalPath",  () => new AnalyzeCriticalPath())
                         .Prop("GroupedBy", new ObjectInfoBuilder()
                               .Prop("Pips", new PipsScope())
                               .Prop("Files", () => GroupFiles(PipGraph.AllFiles))
                               .Prop("Directories", () => GroupDirs(PipGraph.AllSealDirectories))
                               .Build())
                         .Build();

            RootEnv = new Env(
                parent: null,
                resolver: (obj) =>
            {
                return(Renderer.GetObjectInfo(context: this, obj).SetValidator(obj => !Renderer.IsInvalid(obj)));
            },
                vars: LibraryFunctions.All.ToDictionary(f => '$' + f.Name, f => Result.Scalar(f)),
                current: RootObject);

            Evaluator = new Evaluator(
                new Env(parent: RootEnv, resolver: RootEnv.Resolver, current: RootEnv.Current),
                Analyzer.EnableEvalCaching,
                Analyzer.EnsureOrdering);
        }
 private Process[] HydrateAllProcesses()
 {
     return(Measure(
                "Loading all processes",
                () =>
     {
         var pipReferences = PipGraph.RetrievePipReferencesOfType(PipType.Process).ToArray();
         var processes = new Process[pipReferences.Length];
         Parallel.For(
             0,
             pipReferences.Length,
             i =>
         {
             processes[i] = (Process)pipReferences[i].HydratePip();
         });
         return processes;
     }));
 }
Example #4
0
        /// <summary>
        /// Exports the contents of the given pip graph. It is expected to no longer change as of the start of this call.
        /// </summary>
        public override int Analyze()
        {
            DgmlWriter writer = new DgmlWriter();

            Dictionary <PipId, PipReference> concretePipValues = new Dictionary <PipId, PipReference>();

            HashSet <PipReference> allValuePips = new HashSet <PipReference>(PipGraph.RetrievePipReferencesOfType(PipType.Value));

            foreach (var valuePip in allValuePips)
            {
                foreach (var incoming in DataflowGraph.GetIncomingEdges(valuePip.PipId.ToNodeId()))
                {
                    if (!PipTable.GetPipType(incoming.OtherNode.ToPipId()).IsMetaPip())
                    {
                        concretePipValues[valuePip.PipId] = valuePip;
                    }
                }
            }

            foreach (var concretePipValue in concretePipValues.Values)
            {
                var value = ((ValuePip)concretePipValue.HydratePip()).Symbol.ToString(SymbolTable);
                writer.AddNode(new DgmlWriter.Node(concretePipValue.PipId.ToString(), value));

                foreach (var incoming in DataflowGraph.GetIncomingEdges(concretePipValue.PipId.ToNodeId()))
                {
                    var incomingId = incoming.OtherNode.ToPipId();
                    if (concretePipValues.ContainsKey(incomingId))
                    {
                        writer.AddLink(new DgmlWriter.Link(
                                           incomingId.ToString(),
                                           concretePipValue.PipId.ToString(),
                                           label: null));
                    }
                }
            }

            writer.Serialize(m_dgmlFilePath);

            return(0);
        }
Example #5
0
        /// <nodoc />
        public XlgDebuggerState(DebugLogsAnalyzer analyzer)
            : base(XlgThreadId)
        {
            Analyzer = analyzer;

            var logFile = Path.Combine(Path.GetDirectoryName(Analyzer.Input.ExecutionLogPath), "BuildXL.log");

            StackTrace = new[]
            {
                new DisplayStackTraceEntry(file: logFile, line: 1, position: 1, functionName: "<main>", entry: null)
            };

            PipsByType = new ObjectInfo(Enum
                                        .GetValues(typeof(PipType))
                                        .Cast <PipType>()
                                        .Except(new[] { PipType.Max })
                                        .Select(pipType => new Property(pipType.ToString(), () => PipGraph.RetrievePipReferencesOfType(pipType).ToArray())));

            PipsByStatus = new ObjectInfo(Enum
                                          .GetValues(typeof(PipExecutionLevel))
                                          .Cast <PipExecutionLevel>()
                                          .Select(level => level.ToString())
                                          .Concat(new[] { ExeLevelNotCompleted })
                                          .Select(levelStr => new Property(levelStr, () => GetPipsForExecutionLevel(levelStr))));

            RootObject = new ObjectInfo(preview: "Root", properties: new[]
            {
                new Property("Pips", () => PipGraph.RetrieveAllPips()),
                new Property("Files", () => PipGraph.AllFiles),
                new Property("Directories", () => PipGraph.AllSealDirectories),
                //new Property("CriticalPath",  new AnalyzeCricialPath()),
                new Property("GroupedBy", new ObjectInfo(new[]
                {
                    new Property("Pips", new PipsScope()),
                    new Property("Files", () => GroupFiles(PipGraph.AllFiles)),
                    new Property("Directories", () => GroupDirs(PipGraph.AllSealDirectories))
                }))
            });

            RootEnv = new Env(
                parent: null,
                resolver: (obj) =>
            {
                var result = Renderer.GetObjectInfo(context: this, obj);
                return(new ObjectInfo(
                           result.Preview,
                           properties: result.Properties
                           .Select(p => new Property(p.Name, value: Renderer.IsInvalid(p.Value) ? new object[0] : p.Value))
                           .ToArray()));
            },
                vars: LibraryFunctions.All.ToDictionary(f => '$' + f.Name, f => Result.Scalar(f)),
                current: RootObject);

            Evaluator = new Evaluator(new Env(parent: RootEnv, resolver: RootEnv.Resolver, current: RootEnv.Current));
        }