MemoryStats.cs 1.5 KB

12345678910111213141516171819202122232425
  1. #if BESTHTTP_PROFILE && UNITY_2021_2_OR_NEWER
  2. using Unity.Profiling;
  3. namespace Best.HTTP.Profiler.Memory
  4. {
  5. public sealed class MemoryStats
  6. {
  7. public const string CategoryName = "Best - Memory";
  8. public static readonly ProfilerCategory Category = new ProfilerCategory(CategoryName, ProfilerCategoryColor.Scripts);
  9. public const string BorrowedName = "Borrowed";
  10. public static readonly ProfilerCounterValue<long> Borrowed = new ProfilerCounterValue<long>(Category, BorrowedName, ProfilerMarkerDataUnit.Bytes, ProfilerCounterOptions.FlushOnEndOfFrame | ProfilerCounterOptions.ResetToZeroOnFlush);
  11. public const string PooledName = "Pooled";
  12. public static readonly ProfilerCounterValue<long> Pooled = new ProfilerCounterValue<long>(Category, PooledName, ProfilerMarkerDataUnit.Bytes, ProfilerCounterOptions.FlushOnEndOfFrame | ProfilerCounterOptions.ResetToZeroOnFlush);
  13. public const string CacheHitsName = "Cache Hits";
  14. public static readonly ProfilerCounterValue<long> CacheHits = new ProfilerCounterValue<long>(Category, CacheHitsName, ProfilerMarkerDataUnit.Count, ProfilerCounterOptions.FlushOnEndOfFrame | ProfilerCounterOptions.ResetToZeroOnFlush);
  15. public const string ArrayAllocationsName = "Array Allocations (Cache Misses)";
  16. public static readonly ProfilerCounterValue<long> ArrayAllocations = new ProfilerCounterValue<long>(Category, ArrayAllocationsName, ProfilerMarkerDataUnit.Count, ProfilerCounterOptions.FlushOnEndOfFrame | ProfilerCounterOptions.ResetToZeroOnFlush);
  17. }
  18. }
  19. #endif