DebuggerComponent.ProfilerInformationWindow.cs 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //------------------------------------------------------------
  2. // Game Framework
  3. // Copyright © 2013-2021 loyalsoft. All rights reserved.
  4. // Homepage: http://www.game7000.com/
  5. // Feedback: http://www.game7000.com/
  6. //------------------------------------------------------------
  7. using GameFramework;
  8. using UnityEngine;
  9. #if UNITY_5_5_OR_NEWER
  10. using UnityEngine.Profiling;
  11. #endif
  12. namespace UnityGameFramework.Runtime
  13. {
  14. public sealed partial class DebuggerComponent : GameFrameworkComponent
  15. {
  16. private sealed class ProfilerInformationWindow : ScrollableDebuggerWindowBase
  17. {
  18. protected override void OnDrawScrollableWindow()
  19. {
  20. GUILayout.Label("<b>Profiler Information</b>");
  21. GUILayout.BeginVertical("box");
  22. {
  23. DrawItem("Supported", Profiler.supported.ToString());
  24. DrawItem("Enabled", Profiler.enabled.ToString());
  25. DrawItem("Enable Binary Log", Profiler.enableBinaryLog ? Utility.Text.Format("True, {0}", Profiler.logFile) : "False");
  26. #if UNITY_2019_3_OR_NEWER
  27. DrawItem("Enable Allocation Callstacks", Profiler.enableAllocationCallstacks.ToString());
  28. #endif
  29. #if UNITY_2018_3_OR_NEWER
  30. DrawItem("Area Count", Profiler.areaCount.ToString());
  31. #endif
  32. #if UNITY_5_3 || UNITY_5_4
  33. DrawItem("Max Samples Number Per Frame", Profiler.maxNumberOfSamplesPerFrame.ToString());
  34. #endif
  35. #if UNITY_2018_3_OR_NEWER
  36. DrawItem("Max Used Memory", GetByteLengthString(Profiler.maxUsedMemory));
  37. #endif
  38. #if UNITY_5_6_OR_NEWER
  39. DrawItem("Mono Used Size", GetByteLengthString(Profiler.GetMonoUsedSizeLong()));
  40. DrawItem("Mono Heap Size", GetByteLengthString(Profiler.GetMonoHeapSizeLong()));
  41. DrawItem("Used Heap Size", GetByteLengthString(Profiler.usedHeapSizeLong));
  42. DrawItem("Total Allocated Memory", GetByteLengthString(Profiler.GetTotalAllocatedMemoryLong()));
  43. DrawItem("Total Reserved Memory", GetByteLengthString(Profiler.GetTotalReservedMemoryLong()));
  44. DrawItem("Total Unused Reserved Memory", GetByteLengthString(Profiler.GetTotalUnusedReservedMemoryLong()));
  45. #else
  46. DrawItem("Mono Used Size", GetByteLengthString(Profiler.GetMonoUsedSize()));
  47. DrawItem("Mono Heap Size", GetByteLengthString(Profiler.GetMonoHeapSize()));
  48. DrawItem("Used Heap Size", GetByteLengthString(Profiler.usedHeapSize));
  49. DrawItem("Total Allocated Memory", GetByteLengthString(Profiler.GetTotalAllocatedMemory()));
  50. DrawItem("Total Reserved Memory", GetByteLengthString(Profiler.GetTotalReservedMemory()));
  51. DrawItem("Total Unused Reserved Memory", GetByteLengthString(Profiler.GetTotalUnusedReservedMemory()));
  52. #endif
  53. #if UNITY_2018_1_OR_NEWER
  54. DrawItem("Allocated Memory For Graphics Driver", GetByteLengthString(Profiler.GetAllocatedMemoryForGraphicsDriver()));
  55. #endif
  56. #if UNITY_5_5_OR_NEWER
  57. DrawItem("Temp Allocator Size", GetByteLengthString(Profiler.GetTempAllocatorSize()));
  58. #endif
  59. DrawItem("Marshal Cached HGlobal Size", GetByteLengthString(Utility.Marshal.CachedHGlobalSize));
  60. }
  61. GUILayout.EndVertical();
  62. }
  63. }
  64. }
  65. }