initial commit
This commit is contained in:
parent
6715289efe
commit
788c3389af
37645 changed files with 2526849 additions and 80 deletions
|
@ -0,0 +1,57 @@
|
|||
using System.Diagnostics;
|
||||
|
||||
namespace UnityEditor.Build.Profiler
|
||||
{
|
||||
internal class BuildProfiler
|
||||
{
|
||||
Stopwatch[] m_Trackers;
|
||||
long[] m_CallCount;
|
||||
string[] m_Names;
|
||||
|
||||
public BuildProfiler(int count)
|
||||
{
|
||||
m_Trackers = new Stopwatch[count];
|
||||
m_CallCount = new long[count];
|
||||
m_Names = new string[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
m_Trackers[i] = new Stopwatch();
|
||||
m_CallCount[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void Start(int index, string name)
|
||||
{
|
||||
if (m_Trackers == null)
|
||||
return;
|
||||
|
||||
Debug.Assert(!m_Trackers[index].IsRunning);
|
||||
m_Trackers[index].Start();
|
||||
m_CallCount[index]++;
|
||||
m_Names[index] = name;
|
||||
}
|
||||
|
||||
public void Stop(int index)
|
||||
{
|
||||
if (m_Trackers == null)
|
||||
return;
|
||||
|
||||
Debug.Assert(m_Trackers[index].IsRunning);
|
||||
m_Trackers[index].Stop();
|
||||
}
|
||||
|
||||
public void Print()
|
||||
{
|
||||
if (m_Trackers == null)
|
||||
return;
|
||||
|
||||
string msg = "";
|
||||
for (int i = 0; i < m_Trackers.Length; i++)
|
||||
{
|
||||
Debug.Assert(!m_Trackers[i].IsRunning);
|
||||
msg += string.Format("Counter[{0}]\t{1}\t{2}\n", m_Names[i], m_CallCount[i], m_Trackers[i].ElapsedMilliseconds);
|
||||
}
|
||||
UnityEngine.Debug.Log(msg);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ba1f63c8c87d5ab4cad407b7245879e4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue