﻿#region Header

// Copyright (c) 2021-2022 AccelByte Inc. All Rights Reserved.
// This is licensed software from AccelByte Inc, for limitations
// and restrictions contact your company contract manager.

#endregion

namespace BlackBox.Utils
{
    public class PerformanceProfiler
    {
        private IStats _source;

        private PerformanceProfiler(IStats source)
        {
            _source = source;
        }

        public void Capture()
        {
            _source.Capture();
        }

        public float GetCpuTime()
        {
            return _source.GetCpuTime();
        }

        public float GetGpuTime()
        {
            return _source.GetGpuTime();
        }

        public static PerformanceProfiler ResolveProfiler()
        {
#if UNITY_EDITOR
            return new PerformanceProfiler(new EditorStats());
#else
            return new PerformanceProfiler(new PlatformStats());
#endif
        }
    }
}
