Пример #1
0
        public EventsThreadRow(FrameGroup group, ThreadDescription desc, ThreadData data)
        {
            Description = desc;
            EventData   = data;
            Group       = group;
            MaxDepth    = 1;

            Header = new ThreadNameView()
            {
                DataContext = this
            };

            UpdateThreadsDepth();

            switch (Controls.Settings.LocalSettings.Data.ThreadExpandMode)
            {
            case Controls.LocalSettings.ExpandMode.CollapseAll:
                _isExpanded = false;
                break;

            case Controls.LocalSettings.ExpandMode.ExpandAll:
                _isExpanded = true;
                break;

            case Controls.LocalSettings.ExpandMode.ExpandMain:
                _isExpanded = group.MainThread.Description == desc;
                break;
            }
        }
Пример #2
0
 public ChartRow(String name, List <Tick> timestamps, List <Entry> entries, double maxValue)
 {
     ChartName  = name;
     Timestamps = timestamps;
     Entries    = entries;
     MaxValue   = maxValue;
     Header     = new ThreadNameView()
     {
         DataContext = this
     };
 }
Пример #3
0
        public EventsThreadRow(FrameGroup group, ThreadDescription desc, ThreadData data)
        {
            Description = desc;
            EventData   = data;
            Group       = group;
            MaxDepth    = 1;

            Header = new ThreadNameView()
            {
                DataContext = this
            };

            List <EventNode> rootCategories = new List <EventNode>();
            List <EventNode> nodesToProcess = new List <EventNode>();

            foreach (EventFrame frame in data.Events)
            {
                // Fill holes in timeline from regular events (not categories)
                // ------------------------------------------------------------------------------------------------------
                const double thresholdMs = 0.1;

                EventTree categoriesTree = frame.CategoriesTree;
                rootCategories.Clear();
                foreach (EventNode node in frame.CategoriesTree.Children)
                {
                    rootCategories.Add(node);
                }

                if (rootCategories.Count != 0)
                {
                    nodesToProcess.Clear();
                    foreach (EventNode node in frame.Root.Children)
                    {
                        nodesToProcess.Add(node);
                    }

                    while (nodesToProcess.Count > 0)
                    {
                        EventNode node = nodesToProcess[0];
                        nodesToProcess.RemoveAt(0);

                        bool nodeIntersectWithCategories = false;

                        foreach (EventNode categoryNode in rootCategories)
                        {
                            // drop nodes less than thresholdMs ms
                            if (node.Entry.Duration < thresholdMs)
                            {
                                nodeIntersectWithCategories = true;
                                break;
                            }

                            // node is entirely inside the categoryNode
                            if (node.Entry.Start >= categoryNode.Entry.Start && node.Entry.Finish <= categoryNode.Entry.Finish)
                            {
                                nodeIntersectWithCategories = true;
                                break;
                            }

                            // node is partially inside the categoryNode
                            if (node.Entry.Intersect(categoryNode.Entry))
                            {
                                foreach (EventNode tmp in node.Children)
                                {
                                    nodesToProcess.Add(tmp);
                                }

                                nodeIntersectWithCategories = true;
                                break;
                            }
                        }

                        if (nodeIntersectWithCategories == false && node.Entry.Duration >= thresholdMs)
                        {
                            // node is not intersect with any categoryNode (add to category tree)
                            EventNode fakeCategoryNode = new EventNode(frame.CategoriesTree, node.Entry);

                            node.Entry.SetOverrideColor(GenerateColorFromString(node.Entry.Description.FullName));

                            rootCategories.Add(fakeCategoryNode);
                            frame.CategoriesTree.Children.Add(fakeCategoryNode);
                        }
                    }
                }
                // ------------------------------------------------------------------------------------------------------
            }

            UpdateDepth();
        }