blob: 6bd83aa92b68d738b85e96112003d42a30291433 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/* ---------------------------------------
* Author: Martin Pane (martintayx@gmail.com) (@tayx94)
* Collaborators: Lars Aalbertsen (@Rockylars)
* Project: Graphy - Ultimate Stats Monitor
* Date: 15-Dec-17
* Studio: Tayx
*
* This project is released under the MIT license.
* Attribution is not required, but it is always welcomed!
* -------------------------------------*/
using UnityEngine;
#if UNITY_5_5_OR_NEWER
using UnityEngine.Profiling;
#endif
namespace Tayx.Graphy.Ram
{
public class G_RamMonitor : MonoBehaviour
{
/* ----- TODO: ----------------------------
* Add summaries to the variables.
* Add summaries to the functions.
* --------------------------------------*/
#region Variables -> Private
private float m_allocatedRam = 0;
private float m_reservedRam = 0;
private float m_monoRam = 0;
#endregion
#region Properties -> Public
public float AllocatedRam { get { return m_allocatedRam; } }
public float ReservedRam { get { return m_reservedRam; } }
public float MonoRam { get { return m_monoRam; } }
#endregion
#region Methods -> Unity Callbacks
private void Update()
{
#if UNITY_5_6_OR_NEWER
m_allocatedRam = Profiler.GetTotalAllocatedMemoryLong()/ 1048576f;
m_reservedRam = Profiler.GetTotalReservedMemoryLong() / 1048576f;
m_monoRam = Profiler.GetMonoUsedSizeLong() / 1048576f;
#else
m_allocatedRam = Profiler.GetTotalAllocatedMemory() / 1048576f;
m_reservedRam = Profiler.GetTotalReservedMemory() / 1048576f;
m_monoRam = Profiler.GetMonoUsedSize() / 1048576f;
#endif
}
#endregion
}
}
|