protected Graph getGraph(string name, GraphUnits units)
        {
            Graph graph;

            if (!_graphs.TryGetValue(name, out graph))
            {
                graph         = new Graph(name, units, _historyLength);
                _graphs[name] = graph;

                GameObject buttonObj = Instantiate(customGraphPrefab);
                buttonObj.transform.SetParent(customGraphPrefab.transform.parent, false);

                Text buttonText = buttonObj.GetComponentInChildren <Text>();
                buttonText.text = name.Replace(' ', '\n');

                Button button = buttonObj.GetComponentInChildren <Button>();
                addCallback(button, name);

                buttonObj.SetActive(true);

                if (_currentGraph == null && name == _defaultGraph)
                {
                    SwtichGraph(name);
                }
            }
            return(graph);
        }
 public Graph(string name, GraphUnits units, int maxHistory)
 {
     this.name       = name;
     this.units      = units;
     this.maxHistory = maxHistory;
     exclusive       = new Deque <float>(maxHistory);
     inclusive       = new Deque <float>(maxHistory);
     exclusiveMax    = new SlidingMax(maxHistory);
     inclusiveMax    = new SlidingMax(maxHistory);
 }
 public GraphKey(string name, GraphUnits units, long tick = 0)
 {
     this.name  = name;
     this.units = units;
     this.tick  = tick;
 }
        public void AddSample(string sampleName, GraphUnits units, float ms)
        {
            Graph graph = getGraph(sampleName, units);

            graph.AddSample((long)(ms * System.Diagnostics.Stopwatch.Frequency * 0.001f));
        }
        public void AddSample(string sampleName, GraphUnits units, long ticks)
        {
            Graph graph = getGraph(sampleName, units);

            graph.AddSample(ticks);
        }
        public void BeginSample(string sampleName, GraphUnits units)
        {
            GraphKey key = new GraphKey(sampleName, units, _stopwatch.ElapsedTicks);

            _keyBuffer.PushFront(key);
        }