Beispiel #1
0
        private TimelineNode BuildTimelineRoot(BinaryReader reader, UnitValue unit)
        {
            uint numTracks = reader.ReadUInt32();

            TimelineNode root = new TimelineNode("", 0, 0, CompilerData.CompileCategory.Timeline);

            InitializeNodeRecursive(root);

            for (uint i = 0; i < numTracks; ++i)
            {
                TimelineNode tree = BuildTimelineTree(reader);

                if (tree.Children.Count > 0 && tree.Children[0].Category == CompilerData.CompileCategory.ExecuteCompiler)
                {
                    //skip the thread for the main track
                    tree       = tree.Children[0];
                    tree.Value = unit;
                }

                //Initialize nodes
                InitializeNodeRecursive(tree, GetBaseDepthLevel(root, tree));
                root.MaxDepthLevel = Math.Max(root.MaxDepthLevel, tree.MaxDepthLevel);

                root.AddChild(tree);
            }

            AdjustNodeProperties(root);

            root.Value = unit;
            root.Label = unit.Name + " ( " + Common.UIConverters.GetTimeStr(root.Duration) + " )";

            return(root.Children.Count > 0? root : null);
        }
Beispiel #2
0
        private TimelineNode BuildTimelineTree(BinaryReader reader)
        {
            uint numEvents = reader.ReadUInt32();

            TimelineNode root = new TimelineNode(CompilerData.CompileCategory.Thread.ToString(), 0, 0, CompilerData.CompileCategory.Thread);

            TimelineNode parent = root;

            for (uint i = 0u; i < numEvents; ++i)
            {
                TimelineNode newNode = LoadNode(reader);

                //Find parent node
                while (parent != root && (newNode.Start >= (parent.Start + parent.Duration)))
                {
                    parent = parent.Parent;
                }

                parent.AddChild(newNode);
                parent = newNode.Duration == 0 ? parent : newNode;
            }

            AdjustNodeProperties(root);

            return(root);
        }