Exemple #1
0
    public static void EndTimingAndReport(string s)
    {
        //TODO should we use ticks instead of ms?
        long       timeNow = s_stopwatch.ElapsedMilliseconds;
        TimingList l       = GetTimingList(s);

        if (l.Count == 0)
        {
            UnityEngine.Debug.LogError("Mismatched profiler timing for: " + s);
            return;
        }
        long lastTimingStart = l[l.Count - 1];

        l.RemoveAt(l.Count - 1);
        long        diff = timeNow - lastTimingStart;
        TimingCount t    = AddTotalTiming(s, diff);

        UnityEngine.Debug.Log(string.Format("[{0}] took [{1}ms ({2}s)] time for [{3}] calls (Avg [{4}])", s, t.totalTime, (float)t.totalTime / 1000, t.calls, t.totalTime / t.calls));
    }
Exemple #2
0
    public static void EndTiming(string s)
    {
        long       timeNow = s_stopwatch.ElapsedMilliseconds;
        TimingList l       = GetTimingList(s);

        if (l.Count == 0)
        {
            UnityEngine.Debug.LogError("Mismatched profiler timing for: " + s);
            return;
        }

        //pop off start time of the most recent start tracking of s
        //calc the difference from then till now and record it
        long lastTimingStart = l[l.Count - 1];

        l.RemoveAt(l.Count - 1);
        long diff = timeNow - lastTimingStart;

        AddTotalTiming(s, diff);
    }