Exemple #1
0
    void OnGUI()
    {
        SetGUISkinFontSize(50);

        options[0] = GUILayout.MinWidth(800);
        options[1] = GUILayout.MinHeight(60);

        GUILayout.Label(string.Format("Cpp used: {0}", UPerfQuery.getNativeUsedSizeAndroid()), options);
        GUILayout.Label(string.Format("Cpp heap: {0}", UPerfQuery.getNativeHeapSizeAndroid()), options);
        GUILayout.Label(string.Format("C# used: {0}", UPerfQuery.getGCUsedSize()), options);
        GUILayout.Label(string.Format("C# heap: {0}", UPerfQuery.getGCHeapSize()), options);
        GUILayout.Label(string.Format("System.GC: {0}", UPerfQuery.getSysGCTotal()), options);
        GUILayout.Label(string.Format("last frame: {0:0.00}%", _lastFrame.ratio), options);
        GUILayout.Label(string.Format("last 3 sec: {0:0.00}%", _last3Sec.ratio), options);

        if (GUILayout.Button("fill mem"))
        {
            _fillMem = true;
        }

        if (GUILayout.Button("clear mem"))
        {
            _fillMem = false;
        }
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        float curTime  = Time.realtimeSinceStartup;
        float curUsage = UPerfQuery.getThreadCpuUsageInSecAndroid();

        if (_fillMem)
        {
            if ((int)curTime % 3 == 0)
            {
                _memFiller.Add(new byte[1024 * 1024]);
            }
        }
        else
        {
            _memFiller.Clear();
            System.GC.Collect();
        }

        _lastFrame.Update(curTime, curUsage);

        if (curTime - _last3Sec.lastTimestamp > 3.0f)
        {
            _last3Sec.Update(curTime, curUsage);
        }
    }