Ejemplo n.º 1
0
        public ProfilerValueManager GetStat(string Name)
        {
            ProfilerValueManager manager = null;

            Stats.TryGetValue(Name, out manager);
            return(manager);
        }
Ejemplo n.º 2
0
 public void AddStat(string Name, double value)
 {
     if (!Stats.ContainsKey(Name))
     {
         Stats[Name] = new ProfilerValueManager();
     }
     Stats[Name].AddStat(value);
 }
Ejemplo n.º 3
0
        public FastBitmap DrawGraph(string StatName)
        {
            Bitmap     bitmap = new Bitmap(200, 200, PixelFormat.Format24bppRgb);
            FastBitmap bmp    = new FastBitmap(bitmap);

            bmp.LockBitmap();

            ProfilerValueManager statManager = GetStat(StatName);
            double MaxVal = 0;

            if (statManager != null)
            {
                MaxVal = statManager.GetMaxValue();
            }

            double ScaleFactor = 1 / (MaxVal / 200); //We multiply by this so that the graph uses the full space

            double[] Stats2 = new double[0];
            if (statManager != null)
            {
                Stats2 = statManager.GetInfos();
            }

            for (int i = 0; i < Stats2.Length; i++)
            {
                //Update the scales
                Stats2[i] = Stats2[i] * ScaleFactor;
            }

            for (int x = 200; x > 0; x--)
            {
                for (int y = 200; y > 0; y--)
                {
                    //Note: we do 200-y to flip the graph on the Y axis
                    if (IsInGraphBar(x, y, Stats2, ScaleFactor))
                    {
                        bmp.SetPixel(x, 200 - y, BarColor);
                    }
                    else
                    {
                        //Check whether the line needs drawn
                        bmp.SetPixel(x, 200 - y, DrawLine(y, ScaleFactor) ? LineColor : BackgroundColor);
                    }
                }
            }
            bmp.UnlockBitmap();

            return(bmp);
        }
Ejemplo n.º 4
0
 public void AddStat(string Name, double value)
 {
     if (!Stats.ContainsKey(Name))
         Stats[Name] = new ProfilerValueManager();
     Stats[Name].AddStat(value);
 }