Ejemplo n.º 1
0
 public void ProfileStart(CustomProfileInfo info)
 {
     if (Enabled)
     {
         Start(info);
     }
 }
Ejemplo n.º 2
0
 public ProfileInfos()
 {
     for (int i = 0; i < (int)CustomProfilerStep.End; i++)
     {
         _profileInfos[i] = new CustomProfileInfo(((CustomProfilerStep)i).ToString());
         SingletonManager.Get <MyProfilerManager>().Add(_profileInfos[i].Name);
     }
 }
Ejemplo n.º 3
0
        private static void Start(CustomProfileInfo info)
        {
            if (Debug)
            {
                _logger.InfoFormat("Begin Profiler {0}", info.Name);
                _profilerStack.Push(info.Name);
            }

            info.BeginProfile();
        }
Ejemplo n.º 4
0
        public CustomProfileInfo Get(String name)
        {
            if (!_customProfile.ContainsKey(name))
            {
                _customProfile[name] = new CustomProfileInfo(name);
                SingletonManager.Get <MyProfilerManager>().Add(_customProfile[name].Name);
            }

            return(_customProfile[name]);
        }
Ejemplo n.º 5
0
 public void AddTo(CustomProfileInfo to)
 {
     to.Total       += Total;
     to.Times       += Times;
     to.Memory       = Memory;
     to.TotalMemory += TotalMemory;
     to.StartMemory  = StartMemory;
     to.GcCount      = GcCount;
     to.ExecCount   += ExecCount;
     to.GcTotal     += GcTotal;
     to.AddInfo      = AddInfo;
 }
Ejemplo n.º 6
0
 public void CopyTo(CustomProfileInfo to)
 {
     to.Total       = Total;
     to.Times       = Times;
     to.Memory      = Memory;
     to.TotalMemory = TotalMemory;
     to.StartMemory = StartMemory;
     to.GcCount     = GcCount;
     to.GcTotal     = GcTotal;
     to.ExecCount   = ExecCount;
     to.AddInfo     = AddInfo;
 }
Ejemplo n.º 7
0
        private static float End(CustomProfileInfo info)
        {
            if (Debug)
            {
                _logger.InfoFormat("End Profiler {0}", info.Name);
                var name = _profilerStack.Pop();
                if (!info.Name.Equals(name, System.StringComparison.Ordinal))
                {
                    _logger.ErrorFormat("End Mismatch Profiler {0}-{1}", name, info.Name);
                }
            }

            return(info.EndProfile());
        }
Ejemplo n.º 8
0
        public float ProfileEnd(CustomProfileInfo info)
        {
            if (Enabled)
            {
                var t = End(info);
                if (t > 5f)
                {
                    _current.Profile = string.Format("{0}_{1}", info.Name, t);
                }

                return(t);
            }

            return(0.0f);
        }
Ejemplo n.º 9
0
 private static void GetInfoHtml(StringBuilder sb, CustomProfileInfo info, float total)
 {
     sb.Append("<tr>");
     sb.Append("<td>").Append(info.Name).Append("</td>");
     sb.Append("<td>").Append(info.AddInfo).Append("</td>");
     sb.Append("<td>").Append(info.Times).Append("</td>");
     sb.Append("<td>").Append(info.Total).Append("</td>");
     sb.Append("<td>").Append(info.Avg).Append("</td>");
     sb.Append("<td>").Append(info.Total / total * 100).Append("</td>");
     sb.Append("<td>").Append(info.AvgMemory / 1024).Append("</td>");
     sb.Append("<td>").Append(info.TotalMemory / 1024).Append("</td>");
     sb.Append("<td>").Append(info.GcCount).Append("</td>");
     sb.Append("<td>").Append(info.GcTotal).Append("</td>");
     sb.Append("<td>").Append(info.ExecCount).Append("</td>");
     sb.Append("</tr>");
 }