// Generate a simple tree. private static SimpleNode AppendChildren(SimpleNode current, double metricValue) { metricValue--; if (metricValue > 0) { SimpleNode newChild = new SimpleNode() { Content = $"Node {metricValue.ToString("0")}", Metric = metricValue, }; current.Children.Add(AppendChildren(newChild, metricValue)); } return(current); }
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); }