diff --git a/Ryujinx.Profiler/Profile.cs b/Ryujinx.Profiler/Profile.cs index a6127fe5d1..8869865e51 100644 --- a/Ryujinx.Profiler/Profile.cs +++ b/Ryujinx.Profiler/Profile.cs @@ -66,6 +66,8 @@ namespace Ryujinx.Profiler { if (!ProfilingEnabled()) return; + if (config.Level > _settings.MaxLevel) + return; _profileInstance.BeginProfile(config); } @@ -74,6 +76,8 @@ namespace Ryujinx.Profiler { if (!ProfilingEnabled()) return; + if (config.Level > _settings.MaxLevel) + return; _profileInstance.EndProfile(config); } diff --git a/Ryujinx.Profiler/ProfileConfig.cs b/Ryujinx.Profiler/ProfileConfig.cs index 44798e95be..8133ac60c8 100644 --- a/Ryujinx.Profiler/ProfileConfig.cs +++ b/Ryujinx.Profiler/ProfileConfig.cs @@ -10,6 +10,8 @@ namespace Ryujinx.Profiler public string SessionGroup; public string SessionItem; + public int Level; + // Private cached variables private string _cachedTag; private string _cachedSession; diff --git a/Ryujinx.Profiler/Settings.cs b/Ryujinx.Profiler/Settings.cs index f74a3cda2d..a3c677d81a 100644 --- a/Ryujinx.Profiler/Settings.cs +++ b/Ryujinx.Profiler/Settings.cs @@ -11,6 +11,7 @@ namespace Ryujinx.Profiler public bool FileDumpEnabled { get; set; } = false; public string DumpLocation { get; set; } = ""; public float UpdateRate { get; set; } = 0.1f; + public int MaxLevel { get; set; } = 0; // 19531225 = 5 seconds in ticks public long History { get; set; } = 19531225; diff --git a/Ryujinx/Config.cs b/Ryujinx/Config.cs index da6b934614..fdff2e8aa2 100644 --- a/Ryujinx/Config.cs +++ b/Ryujinx/Config.cs @@ -75,6 +75,7 @@ namespace Ryujinx DumpLocation = profilePath, UpdateRate = (float)((updateRateHz <= 0) ? -1 : 1.0f / updateRateHz), History = (long)(Convert.ToDouble(parser.Value("Profiling_History")) * PerformanceCounter.TicksPerSecond), + MaxLevel = Convert.ToInt32(parser.Value("Profiling_Max_Level")), }); SystemLanguage SetLanguage = Enum.Parse(parser.Value("System_Language")); diff --git a/Ryujinx/Ryujinx.conf b/Ryujinx/Ryujinx.conf index 2f1436bf18..e3c854cc80 100644 --- a/Ryujinx/Ryujinx.conf +++ b/Ryujinx/Ryujinx.conf @@ -34,6 +34,9 @@ Profiling_Update_Rate = 4 #Set how long to keep profiling data in seconds, reduce if profiling is taking too much RAM Profiling_History = 5 +#Set the maximum profiling level. Higher values may cause a heavy load on your system but will allow you to profile in more detail. +Profiling_Max_Level = 0 + #System Language list: https://gist.github.com/HorrorTroll/b6e4a88d774c3c9b3bdf54d79a7ca43b #Change System Language System_Language = AmericanEnglish