コード例 #1
0
ファイル: Program.cs プロジェクト: xiaomi7732/FlameGraphNet
        private static void ColorizerExample()
        {
            const int  nodeCount = 20;
            SimpleNode root      = new SimpleNode()
            {
                Content = $"Node {nodeCount.ToString("0")}",
                Metric  = nodeCount,
            };

            root = AppendChildren(root, nodeCount);

            FlameGraph newGraph = new FlameGraph(new FlameGraphOptions()
            {
                Title  = "Hello Flame Graph",
                Width  = 800,
                Height = 600,
                FrameBackgroundProvider = node =>
                {
                    if (node.Metric > 10)
                    {
                        return(Color.OrangeRed);
                    }
                    return(Color.DarkOrange);
                },
            });

            string fileName = Path.Combine("Examples", nameof(ColorizerExample) + ".svg");

            DeleteFileWhenExists(fileName);
            newGraph.BuildTo(root, fileName);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: xiaomi7732/FlameGraphNet
        private static void SimpleNodeExample()
        {
            const int  nodeCount = 20;
            SimpleNode root      = new SimpleNode()
            {
                Content = $"Node {nodeCount.ToString("0")}",
                Metric  = nodeCount,
            };

            root = AppendChildren(root, nodeCount);

            FlameGraph newGraph = new FlameGraph(new FlameGraphOptions()
            {
                Title  = "Hello Flame Graph",
                Width  = 800,
                Height = 600,
            });

            string fileName = Path.Combine("Examples", nameof(SimpleNodeExample) + ".svg");

            DeleteFileWhenExists(fileName);
            newGraph.BuildTo(root, fileName);
        }