Split session into 2 seperate values

This commit is contained in:
Andy Adshead 2019-01-24 01:09:03 +00:00
commit 7d8c906335
3 changed files with 38 additions and 7 deletions

View file

@ -97,7 +97,8 @@ namespace Ryujinx.HLE.HOS.Services
Logger.PrintDebug(LogClass.KernelIpc, $"{service.GetType().Name}: {processRequest.Method.Name}"); Logger.PrintDebug(LogClass.KernelIpc, $"{service.GetType().Name}: {processRequest.Method.Name}");
ProfileConfig profile = Profiles.ServiceCall; ProfileConfig profile = Profiles.ServiceCall;
profile.Session = $"{service.GetType().Name}: {processRequest.Method.Name}"; profile.SessionGroup = service.GetType().Name;
profile.SessionItem = processRequest.Method.Name;
Profile.Begin(profile); Profile.Begin(profile);
long result = processRequest(context); long result = processRequest(context);

View file

@ -8,12 +8,13 @@ namespace Ryujinx.Profiler
{ {
public static void ToFile(string path, InternalProfile profile) public static void ToFile(string path, InternalProfile profile)
{ {
String fileData = "Name,Session,Count,Average(ms),Total(ms)\r\n"; String fileData = "Name,Session Group,Session Item,Count,Average(ms),Total(ms)\r\n";
foreach (var time in profile.Timers.OrderBy(key => key.Key.Tag)) foreach (var time in profile.Timers.OrderBy(key => key.Key.Tag))
{ {
fileData += $"{time.Key.Name}," + fileData += $"{time.Key.Name}," +
$"{time.Key.Session}," + $"{time.Key.SessionGroup}," +
$"{time.Key.SessionItem}," +
$"{time.Value.Count}," + $"{time.Value.Count}," +
$"{profile.ConvertTicksToMS(time.Value.AverageTime)}," + $"{profile.ConvertTicksToMS(time.Value.AverageTime)}," +
$"{profile.ConvertTicksToMS(time.Value.TotalTime)}\r\n"; $"{profile.ConvertTicksToMS(time.Value.TotalTime)}\r\n";

View file

@ -7,19 +7,47 @@ namespace Ryujinx.Profiler
public struct ProfileConfig public struct ProfileConfig
{ {
public string Name; public string Name;
public string Session; public string SessionGroup, SessionItem;
private string cachedTag; private string cachedTag, cachedSession;
public string Tag public string Tag
{ {
get get
{ {
if (cachedTag == null) if (cachedTag == null)
cachedTag = $"{Name}{(Session == null ? "" : $" ({Session})")}"; cachedTag = $"{Name}{(Session == "" ? "" : $" ({Session})")}";
return cachedTag; return cachedTag;
} }
} }
public string Session
{
get
{
if (cachedSession == null)
{
if (SessionGroup != null && SessionItem != null)
{
cachedSession = $"{SessionGroup}: {SessionItem}";
}
else if (SessionGroup != null)
{
cachedSession = $"{SessionGroup}";
}
else if (SessionItem != null)
{
cachedSession = $"---: {SessionItem}";
}
else
{
cachedSession = "";
}
}
return cachedSession;
}
}
} }
public static class Profiles public static class Profiles
@ -28,7 +56,8 @@ namespace Ryujinx.Profiler
{ {
public static ProfileConfig Test = new ProfileConfig() public static ProfileConfig Test = new ProfileConfig()
{ {
Name = "CPU.Test", Name = "CPU",
SessionGroup = "Test"
}; };
} }