Service profiling

This commit is contained in:
Andy Adshead 2019-01-24 00:40:00 +00:00
parent cb205fb35c
commit bd39c82342
5 changed files with 20 additions and 6 deletions

View file

@ -6,6 +6,7 @@ using Ryujinx.HLE.HOS.Kernel.Ipc;
using System;
using System.Collections.Generic;
using System.IO;
using Ryujinx.Profiler;
namespace Ryujinx.HLE.HOS.Services
{
@ -95,7 +96,12 @@ namespace Ryujinx.HLE.HOS.Services
Logger.PrintDebug(LogClass.KernelIpc, $"{service.GetType().Name}: {processRequest.Method.Name}");
ProfileConfig profile = Profiles.ServiceCall;
profile.Session = $"{service.GetType().Name}: {processRequest.Method.Name}";
Profile.Begin(profile);
long result = processRequest(context);
Profile.End(profile);
if (_isDomain)
{

View file

@ -65,12 +65,12 @@ namespace Ryujinx.Profiler
return (((double)ticks) / Stopwatch.Frequency) * 1000.0;
}
public int GetSession()
public string GetSession()
{
// Can be called from multiple threads so locked to ensure no duplicate sessions are generated
lock (sessionLock)
{
return sessionCounter++;
return (sessionCounter++).ToString();
}
}
}

View file

@ -57,10 +57,10 @@ namespace Ryujinx.Profiler
End(config);
}
public static int GetSession()
public static string GetSession()
{
if (!ProfilingEnabled())
return 0;
return null;
return ProfileInstance.GetSession();
}
}

View file

@ -7,7 +7,7 @@ namespace Ryujinx.Profiler
public struct ProfileConfig
{
public string Name;
public int? Session;
public string Session;
private string cachedTag;
@ -31,5 +31,10 @@ namespace Ryujinx.Profiler
Name = "CPU.Test",
};
}
public static ProfileConfig ServiceCall = new ProfileConfig()
{
Name = "ServiceCall",
};
}
}

View file

@ -10,6 +10,9 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ryujinx.Tests.Unicorn", "Ryujinx.Tests.Unicorn\Ryujinx.Tests.Unicorn.csproj", "{D8F72938-78EF-4E8C-BAFE-531C9C3C8F15}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ryujinx.HLE", "Ryujinx.HLE\Ryujinx.HLE.csproj", "{CB92CFF9-1D62-4D4F-9E88-8130EF61E351}"
ProjectSection(ProjectDependencies) = postProject
{4E69B67F-8CA7-42CF-A9E1-CCB0915DFB34} = {4E69B67F-8CA7-42CF-A9E1-CCB0915DFB34}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChocolArm64", "ChocolArm64\ChocolArm64.csproj", "{2345A1A7-8DEF-419B-9AFB-4DFD41D20D05}"
EndProject
@ -23,7 +26,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Luea", "Ryujinx.LLE\Luea.cs
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ryujinx.Common", "Ryujinx.Common\Ryujinx.Common.csproj", "{5FD4E4F6-8928-4B3C-BE07-28A675C17226}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ryujinx.Profiler", "Ryujinx.Profiler\Ryujinx.Profiler.csproj", "{4E69B67F-8CA7-42CF-A9E1-CCB0915DFB34}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ryujinx.Profiler", "Ryujinx.Profiler\Ryujinx.Profiler.csproj", "{4E69B67F-8CA7-42CF-A9E1-CCB0915DFB34}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution