コード例 #1
0
ファイル: CPUPerf.cs プロジェクト: whztt07/mobahero_src
 private void dumpInfo()
 {
     if (CPUPerf.PerfNameMap == null)
     {
         return;
     }
     foreach (FuncInfo current in CPUPerf.PerfNameMap.Values)
     {
         if (current.callCount > 0)
         {
             double num  = (double)current.total * this.mRadix;
             double num2 = (double)current.maxTime * this.mRadix;
             double num3 = num / (double)current.callCount;
             this.addCell(current.name);
             this.addCell(current.callCount);
             this.addCell(num);
             this.addCell(num / this.mSpendTime * 100.0);
             this.addCell(num3);
             this.addCell(num2);
             CPUPerf.writeLine();
             current.callCount = 0;
             current.total     = 0L;
             current.maxTime   = 0L;
         }
     }
 }
コード例 #2
0
    private void CPUPerf(string[] param)
    {
        CPUPerf cPUPerf = UnityEngine.Object.FindObjectOfType <CPUPerf>();

        if (cPUPerf != null)
        {
            cPUPerf.mUpdateInterval = int.Parse(param[1]);
            cPUPerf.mDumpFPSLimit   = int.Parse(param[2]);
        }
    }
コード例 #3
0
ファイル: CPUPerf.cs プロジェクト: whztt07/mobahero_src
 public static void Error(string printOut)
 {
     try
     {
         CPUPerf.mCacheString.Append(printOut);
         CPUPerf.writeLine();
         CPUPerf.mPerfFile.Flush();
     }
     catch (Exception var_0_20)
     {
     }
 }
コード例 #4
0
    public static void Start(object target = null)
    {
        if (CPUCount.CounterList == null)
        {
            CPUCount.CounterList = new List <FuncInfo>();
        }
        FuncInfo funcInfo = CPUPerf.getFuncInfo(target);

        CPUCount.CounterList.Add(funcInfo);
        if (++funcInfo.recCnt == 1)
        {
            funcInfo.lastRecord = Stopwatch.GetTimestamp();
        }
    }
コード例 #5
0
ファイル: CPUPerf.cs プロジェクト: whztt07/mobahero_src
 private void Update()
 {
     if (++this.mFrameCnt >= this.mUpdateInterval)
     {
         long num = this.mCPUTime;
         this.mCPUTime   = Stopwatch.GetTimestamp();
         this.mSpendTime = (double)(this.mCPUTime - num) * this.mRadix;
         double num2 = (double)(this.mFrameCnt * 1000) / this.mSpendTime;
         this.mTotalTime += this.mSpendTime;
         this.mFrameCnt   = 0;
         if (num2 < (double)this.mDumpFPSLimit)
         {
             CPUPerf.ForcePrint = false;
             try
             {
                 CPUPerf.writeLine();
                 CPUPerf.mCacheString.Append("FPS:");
                 CPUPerf.mCacheString.Append((float)num2);
                 CPUPerf.mCacheString.Append(" | ");
                 CPUPerf.mCacheString.Append(this.mUpdateInterval);
                 CPUPerf.mCacheString.Append(" frame spend time about(ms): ");
                 CPUPerf.mCacheString.Append((float)this.mSpendTime);
                 CPUPerf.mCacheString.Append(" | cur time(s): ");
                 CPUPerf.mCacheString.Append((float)(this.mTotalTime / 1000.0));
                 CPUPerf.writeLine();
                 this.dumpInfo();
                 CPUPerf.mPerfFile.Flush();
             }
             catch (Exception var_2_133)
             {
             }
         }
         if (CPUPerf.PerfNameMap != null)
         {
             foreach (FuncInfo current in CPUPerf.PerfNameMap.Values)
             {
                 current.callCount = 0;
                 current.total     = 0L;
                 current.maxTime   = 0L;
             }
         }
     }
 }
コード例 #6
0
    public static void Count(object target = null)
    {
        FuncInfo funcInfo = CPUPerf.getFuncInfo(target);

        funcInfo.callCount++;
    }