public void ProfileStart(CustomProfileInfo info)
 {
     if (Enabled)
     {
         Start(info);
     }
 }
 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);
     }
 }
        private static void Start(CustomProfileInfo info)
        {
            if (Debug)
            {
                _logger.InfoFormat("Begin Profiler {0}", info.Name);
                _profilerStack.Push(info.Name);
            }

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

            return(_customProfile[name]);
        }
 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;
 }
 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;
 }
        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());
        }
        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);
        }
 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>");
 }