Render Profiler in GUI (#854)
* move profiler output to gui * addressed commits, rebased * removed whitespaces
This commit is contained in:
parent
db9f8f999f
commit
f2b9a9c2b0
41 changed files with 1358 additions and 1639 deletions
35
Ryujinx.Debugger/Profiler/DumpProfile.cs
Normal file
35
Ryujinx.Debugger/Profiler/DumpProfile.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using Ryujinx.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Ryujinx.Debugger.Profiler
|
||||
{
|
||||
public static class DumpProfile
|
||||
{
|
||||
public static void ToFile(string path, InternalProfile profile)
|
||||
{
|
||||
String fileData = "Category,Session Group,Session Item,Count,Average(ms),Total(ms)\r\n";
|
||||
|
||||
foreach (KeyValuePair<ProfileConfig, TimingInfo> time in profile.Timers.OrderBy(key => key.Key.Tag))
|
||||
{
|
||||
fileData += $"{time.Key.Category}," +
|
||||
$"{time.Key.SessionGroup}," +
|
||||
$"{time.Key.SessionItem}," +
|
||||
$"{time.Value.Count}," +
|
||||
$"{time.Value.AverageTime / PerformanceCounter.TicksPerMillisecond}," +
|
||||
$"{time.Value.TotalTime / PerformanceCounter.TicksPerMillisecond}\r\n";
|
||||
}
|
||||
|
||||
// Ensure file directory exists before write
|
||||
FileInfo fileInfo = new FileInfo(path);
|
||||
if (fileInfo == null)
|
||||
throw new Exception("Unknown logging error, probably a bad file path");
|
||||
if (fileInfo.Directory != null && !fileInfo.Directory.Exists)
|
||||
Directory.CreateDirectory(fileInfo.Directory.FullName);
|
||||
|
||||
File.WriteAllText(fileInfo.FullName, fileData);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue