Skip to content

Commit

Permalink
Small updates and minor refactors, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
seanstolberg-unity committed Sep 21, 2018
1 parent 9f19292 commit 760edcc
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 352 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ public void Setup()

var unprocessedArgs = optionSet.Parse(args);

// Performance tests always need to be run as development build in order to capture performance profiler data
EditorUserBuildSettings.development = true;
PlayerSettings.SplashScreen.showUnityLogo = false;

// Setup all-inclusive player settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public abstract class RenderPerformanceMonoBehaviourTestBase : MonoBehaviour, IMonoBehaviourTest
{
// Number of frames we capture and calculate metrics from
private readonly int numCaptureFrames = 200;
private readonly int numCaptureFrames = 100;
protected static readonly string FpsName = "FPS";
private static readonly string ObjectCountName = "ObjectCount";
private static readonly string VerticesName = "Vertices";
Expand Down Expand Up @@ -146,7 +146,8 @@ private void Update()
FrameCount++;
SampleFps();
#if ENABLE_VR
if (XRSettings.enabled)
// Currently XRStats.TryGetGPUTimeLastFrame only works on OculusRift and OpenVR on Windows
if (XRSettings.enabled && Application.platform == RuntimePlatform.WindowsPlayer)
{
SampleGpuTimeLastFrame();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using UnityEngine.XR;
#endif

[Category("Performance")]
public class DynamicScene_RenderPerfTests : RenderPerformanceTestsBase
{
private readonly string basicSceneName = "RenderPerformance";
Expand Down Expand Up @@ -53,14 +52,14 @@ public IEnumerator Terrain()
var renderPerformanceTest = SetupPerfTest<DynamicRenderPerformanceMonoBehaviourTest>();

// allow time to settle before taking measurements
yield return new WaitForSecondsRealtime(SettleTime);
yield return new WaitForSecondsRealtime(SettleTimeSeconds);

// use ProfilerMarkers API from Performance Test Extension
using (Measure.ProfilerMarkers(SamplerNames))
{
// Set CaptureMetrics flag to TRUE; let's start capturing metrics
renderPerformanceTest.component.CaptureMetrics = true;

// Run the MonoBehaviour Test
yield return renderPerformanceTest;
}
Expand All @@ -79,14 +78,14 @@ public IEnumerator RealtimeLighting_Directional()
var renderPerformanceTest = SetupPerfTest<DynamicRenderPerformanceMonoBehaviourTest>();

// allow time to settle before taking measurements
yield return new WaitForSecondsRealtime(SettleTime);
yield return new WaitForSecondsRealtime(SettleTimeSeconds);

// use ProfilerMarkers API from Performance Test Extension
using (Measure.ProfilerMarkers(SamplerNames))
{
// Set CaptureMetrics flag to TRUE; let's start capturing metrics
renderPerformanceTest.component.CaptureMetrics = true;

// Run the MonoBehaviour Test
yield return renderPerformanceTest;
}
Expand All @@ -105,14 +104,14 @@ public IEnumerator RealtimeLighting_Point()
var renderPerformanceTest = SetupPerfTest<DynamicRenderPerformanceMonoBehaviourTest>();

// allow time to settle before taking measurements
yield return new WaitForSecondsRealtime(SettleTime);
yield return new WaitForSecondsRealtime(SettleTimeSeconds);

// use ProfilerMarkers API from Performance Test Extension
using(Measure.ProfilerMarkers(SamplerNames))
using (Measure.ProfilerMarkers(SamplerNames))
{
// Set CaptureMetrics flag to TRUE; let's start capturing metrics
renderPerformanceTest.component.CaptureMetrics = true;

// Run the MonoBehaviour Test
yield return renderPerformanceTest;
}
Expand All @@ -131,14 +130,14 @@ public IEnumerator RealtimeLighting_Spot()
var renderPerformanceTest = SetupPerfTest<DynamicRenderPerformanceMonoBehaviourTest>();

// allow time to settle before taking measurements
yield return new WaitForSecondsRealtime(SettleTime);
yield return new WaitForSecondsRealtime(SettleTimeSeconds);

// use ProfilerMarkers API from Performance Test Extension
using (Measure.ProfilerMarkers(SamplerNames))
{
// Set CaptureMetrics flag to TRUE; let's start capturing metrics
renderPerformanceTest.component.CaptureMetrics = true;

// Run the MonoBehaviour Test
yield return renderPerformanceTest;
}
Expand All @@ -157,11 +156,12 @@ public IEnumerator SpiralFlame_RenderPerformance()
var renderPerformanceTest = SetupPerfTest<DynamicRenderPerformanceMonoBehaviourTest>();

// allow time to settle before taking measurements
yield return new WaitForSecondsRealtime(SettleTime);
yield return new WaitForSecondsRealtime(SettleTimeSeconds);

// use ProfilerMarkers API from Performance Test Extension
using (Measure.ProfilerMarkers(SamplerNames))
{

// Set CaptureMetrics flag to TRUE; let's start capturing metrics
renderPerformanceTest.component.CaptureMetrics = true;

Expand All @@ -183,14 +183,14 @@ public IEnumerator SetTargetBufferMaterial()
var renderPerformanceTest = SetupPerfTest<DynamicRenderPerformanceMonoBehaviourTest>();

// allow time to settle before taking measurements
yield return new WaitForSecondsRealtime(SettleTime);
yield return new WaitForSecondsRealtime(SettleTimeSeconds);

// use ProfilerMarkers API from Performance Test Extension
using (Measure.ProfilerMarkers(SamplerNames))
{
// Set CaptureMetrics flag to TRUE; let's start capturing metrics
renderPerformanceTest.component.CaptureMetrics = true;

// Run the MonoBehaviour Test
yield return renderPerformanceTest;
}
Expand All @@ -209,14 +209,14 @@ public IEnumerator RenderTextureMaterial()
var renderPerformanceTest = SetupPerfTest<DynamicRenderPerformanceMonoBehaviourTest>();

// allow time to settle before taking measurements
yield return new WaitForSecondsRealtime(SettleTime);
yield return new WaitForSecondsRealtime(SettleTimeSeconds);

// use ProfilerMarkers API from Performance Test Extension
using (Measure.ProfilerMarkers(SamplerNames))
{
// Set CaptureMetrics flag to TRUE; let's start capturing metrics
renderPerformanceTest.component.CaptureMetrics = true;

// Run the MonoBehaviour Test
yield return renderPerformanceTest;
}
Expand All @@ -235,14 +235,14 @@ public IEnumerator StencilMaterial()
var renderPerformanceTest = SetupPerfTest<DynamicRenderPerformanceMonoBehaviourTest>();

// allow time to settle before taking measurements
yield return new WaitForSecondsRealtime(SettleTime);
yield return new WaitForSecondsRealtime(SettleTimeSeconds);

// use ProfilerMarkers API from Performance Test Extension
using (Measure.ProfilerMarkers(SamplerNames))
{
// Set CaptureMetrics flag to TRUE; let's start capturing metrics
renderPerformanceTest.component.CaptureMetrics = true;

// Run the MonoBehaviour Test
yield return renderPerformanceTest;
}
Expand All @@ -261,14 +261,14 @@ public IEnumerator TransparentMaterial()
var renderPerformanceTest = SetupPerfTest<DynamicRenderPerformanceMonoBehaviourTest>();

// allow time to settle before taking measurements
yield return new WaitForSecondsRealtime(SettleTime);
yield return new WaitForSecondsRealtime(SettleTimeSeconds);

// use ProfilerMarkers API from Performance Test Extension
using (Measure.ProfilerMarkers(SamplerNames))
{
// Set CaptureMetrics flag to TRUE; let's start capturing metrics
renderPerformanceTest.component.CaptureMetrics = true;

// Run the MonoBehaviour Test
yield return renderPerformanceTest;
}
Expand All @@ -287,14 +287,14 @@ public IEnumerator GpuInstacingMaterial()
var renderPerformanceTest = SetupPerfTest<DynamicRenderPerformanceMonoBehaviourTest>();

// allow time to settle before taking measurements
yield return new WaitForSecondsRealtime(SettleTime);
yield return new WaitForSecondsRealtime(SettleTimeSeconds);

// use ProfilerMarkers API from Performance Test Extension
using (Measure.ProfilerMarkers(SamplerNames))
{
// Set CaptureMetrics flag to TRUE; let's start capturing metrics
renderPerformanceTest.component.CaptureMetrics = true;

// Run the MonoBehaviour Test
yield return renderPerformanceTest;
}
Expand All @@ -313,14 +313,14 @@ public IEnumerator StandardMaterial()
var renderPerformanceTest = SetupPerfTest<DynamicRenderPerformanceMonoBehaviourTest>();

// allow time to settle before taking measurements
yield return new WaitForSecondsRealtime(SettleTime);
yield return new WaitForSecondsRealtime(SettleTimeSeconds);

// use ProfilerMarkers API from Performance Test Extension
using (Measure.ProfilerMarkers(SamplerNames))
{
// Set CaptureMetrics flag to TRUE; let's start capturing metrics
renderPerformanceTest.component.CaptureMetrics = true;

// Run the MonoBehaviour Test
yield return renderPerformanceTest;
}
Expand All @@ -343,14 +343,14 @@ public IEnumerator SpiralFlame_RenderPerformance_RenderViewPortScale_90_Percent(
XRSettings.renderViewportScale = .9f;

// allow time to settle before taking measurements
yield return new WaitForSecondsRealtime(SettleTime);
yield return new WaitForSecondsRealtime(SettleTimeSeconds);

// use ProfilerMarkers API from Performance Test Extension
using (Measure.ProfilerMarkers(SamplerNames))
{
// Set CaptureMetrics flag to TRUE; let's start capturing metrics
renderPerformanceTest.component.CaptureMetrics = true;

// Run the MonoBehaviour Test
yield return renderPerformanceTest;
}
Expand All @@ -375,14 +375,14 @@ public IEnumerator SpiralFlame_RenderPerformance_RenderViewPortScale_50_Percent(
XRSettings.renderViewportScale = .5f;

// allow time to settle before taking measurements
yield return new WaitForSecondsRealtime(SettleTime);
yield return new WaitForSecondsRealtime(SettleTimeSeconds);

// use ProfilerMarkers API from Performance Test Extension
using (Measure.ProfilerMarkers(SamplerNames))
{
// Set CaptureMetrics flag to TRUE; let's start capturing metrics
renderPerformanceTest.component.CaptureMetrics = true;

// Run the MonoBehaviour Test
yield return renderPerformanceTest;
}
Expand Down
Loading

0 comments on commit 760edcc

Please sign in to comment.