private AndroidMemoryStatistics AllocateMemoryStatistics() { m_LastAllocatedEntry = m_Entries[m_CurrentEntry++]; if (m_CurrentEntry >= kMaxEntries) { m_CurrentEntry = 0; } m_EntryCount = Math.Min(m_EntryCount + 1, kMaxEntries); if (m_SelectedEntry >= 0 && m_EntryCount == kMaxEntries) { m_SelectedEntry--; } return(m_LastAllocatedEntry); }
private UInt64 AggregateMemorySize(AndroidMemoryStatistics stats, MemoryType type) { UInt64 total = 0; MemoryType[] types = GetOrderMemoryTypes(); for (int i = types.Length - 1; i >= 0; i--) { if (types[i] == type) { return(total); } if (!m_State.MemoryTypeEnabled[i]) { continue; } total += stats.GetValue(m_State.MemoryGroup, types[i]); } throw new Exception("Unhandled memory type: " + type); }
public AndroidLogcatMemoryViewer(EditorWindow parent, AndroidLogcatRuntimeBase runtime) { m_Parent = parent; m_Runtime = runtime; m_Material = (Material)EditorGUIUtility.LoadRequired("SceneView/HandleLines.mat"); m_State = m_Runtime.ProjectSettings.MemoryViewerState; for (int i = 0; i < kMaxEntries; i++) { m_Entries[i] = new AndroidMemoryStatistics(); } m_RequestsInQueue = 0; /* * // For Debugging purposes * for (int i = 0; i < kMaxEntries; i++) * { * InjectFakeMemoryStatistics((int)(UnityEngine.Random.value * k16MB * 2.0f)); * } * //**/ m_SplitterStart = 0; m_SplitterDragging = SplitterDragging.None; m_MemoryTypeColors[MemoryType.NativeHeap] = Color.red; m_MemoryTypeColors[MemoryType.JavaHeap] = Color.yellow; m_MemoryTypeColors[MemoryType.Code] = Color.blue; m_MemoryTypeColors[MemoryType.Stack] = Color.cyan; m_MemoryTypeColors[MemoryType.Graphics] = Color.green; m_MemoryTypeColors[MemoryType.PrivateOther] = Color.grey; m_MemoryTypeColors[MemoryType.System] = Color.magenta; m_MemoryTypeColors[MemoryType.Total] = Color.white; ClearEntries(); ValidateSettings(); }