Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 public GraphKey(string name, GraphUnits units, long tick = 0)
 {
     this.name  = name;
     this.units = units;
     this.tick  = tick;
 }
Ejemplo n.º 4
0
        public void AddSample(string sampleName, GraphUnits units, float ms)
        {
            Graph graph = getGraph(sampleName, units);

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

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

            _keyBuffer.PushFront(key);
        }