Skip to content

Commit

Permalink
small change to get statistics for final paper
Browse files Browse the repository at this point in the history
  • Loading branch information
AIP21 committed May 16, 2023
1 parent e41aec1 commit 95e8831
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 151 deletions.
17 changes: 9 additions & 8 deletions Assets/DataStructure/Scripts/DataStructure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class DataStructure : MonoBehaviour, ITickableSystem
#region Debug
[Header("Debug")]
public bool CalculateDebugInfo = false;
public int StatHistory = 50;

[Space(10)]
public float gridReadsPerTick = 0;
Expand Down Expand Up @@ -259,10 +260,10 @@ public void BeginTick(float deltaTime)
{
st.Stop();

Utils.AddToAverageList<float>(_gridReadTimePerTick, (float)st.Elapsed.TotalMilliseconds);
Utils.AddToAverageList<float>(_gridReadTimePerTick, (float)st.Elapsed.TotalMilliseconds, StatHistory);

if (gridReadCount > 0)
Utils.AddToAverageList<float>(_gridReadsPerTick, gridReadCount);
Utils.AddToAverageList<float>(_gridReadsPerTick, gridReadCount, StatHistory);

st.Reset();
st.Start();
Expand Down Expand Up @@ -290,10 +291,10 @@ public void BeginTick(float deltaTime)
{
st.Stop();

Utils.AddToAverageList<float>(_cellReadTimePerTick, (float)st.Elapsed.TotalMilliseconds);
Utils.AddToAverageList<float>(_cellReadTimePerTick, (float)st.Elapsed.TotalMilliseconds, StatHistory);

if (cellReadCount > 0)
Utils.AddToAverageList<float>(_cellReadsPerTick, cellReadCount);
Utils.AddToAverageList<float>(_cellReadsPerTick, cellReadCount, StatHistory);
}
}

Expand Down Expand Up @@ -345,7 +346,7 @@ public void EndTick(float deltaTime)
{
st.Stop();

Utils.AddToAverageList<float>(_gridWriteTimePerTick, (float)st.Elapsed.TotalMilliseconds);
Utils.AddToAverageList<float>(_gridWriteTimePerTick, (float)st.Elapsed.TotalMilliseconds, StatHistory);

st.Reset();
st.Start();
Expand Down Expand Up @@ -373,12 +374,12 @@ public void EndTick(float deltaTime)
{
st.Stop();

Utils.AddToAverageList<float>(_cellWriteTimePerTick, (float)st.Elapsed.TotalMilliseconds);
Utils.AddToAverageList<float>(_cellWriteTimePerTick, (float)st.Elapsed.TotalMilliseconds, StatHistory);

if (gridWriteCount > 0)
Utils.AddToAverageList<float>(_gridWritesPerTick, gridWriteCount);
Utils.AddToAverageList<float>(_gridWritesPerTick, gridWriteCount, StatHistory);
if (cellWriteCount > 0)
Utils.AddToAverageList<float>(_cellWritesPerTick, cellWriteCount);
Utils.AddToAverageList<float>(_cellWritesPerTick, cellWriteCount, StatHistory);

gridReadsPerTick = Utils.Average(_gridReadsPerTick);
cellReadsPerTick = Utils.Average(_cellReadsPerTick);
Expand Down
202 changes: 102 additions & 100 deletions Assets/Scenes/Ecosystem Simulation.unity
Original file line number Diff line number Diff line change
Expand Up @@ -11752,6 +11752,7 @@ MonoBehaviour:
- {fileID: 6456605024775582197}
- {fileID: 542635039}
CalculateDebugInfo: 1
StatHistory: 50
gridReadsPerTick: 0
gridWritesPerTick: 0
gridActivityPerTick: 0
Expand Down Expand Up @@ -21771,14 +21772,14 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 985569e64189cbb469fd53f9e3b46c55, type: 3}
m_Name:
m_EditorClassIdentifier:
RandomTreeCountPerTick: 100
RandomTickRate: 1
RandomTreeCountPerTick: 5
RandomTickRate: 0.8
CollectInitialChildTrees: 0
GenerateInitialTrees: 1
InitialTreeCount: 100
InitialTreeGenerationBounds:
m_Center: {x: 100, y: 10, z: 100}
m_Extent: {x: 100, y: 10, z: 100}
m_Center: {x: 250, y: 10, z: 250}
m_Extent: {x: 250, y: 10, z: 250}
TestTreePrefab: {fileID: 2512629738840422531, guid: 0baa68192c27f434cb5441f33316dd05, type: 3}
TestParameters:
StemSize: 0.3
Expand All @@ -21792,7 +21793,7 @@ MonoBehaviour:
RadialBias: 0.2
AngleRandomness: 0.5
GenerateBranchMesh: 1
GenerateLeafMesh: 0
GenerateLeafMesh: 1
GenerateLeafColliders: 0
GenerateBranchColliders: 0
GrowThreshold: 60
Expand Down Expand Up @@ -23167,6 +23168,7 @@ MonoBehaviour:
- {fileID: 542635039}
- {fileID: 525463473}
CalculateDebugInfo: 1
StatHistory: 50
BeginTickTime: 0
TickTime: 0
EndTickTime: 0
Expand Down Expand Up @@ -49801,100 +49803,6 @@ Transform:
m_Father: {fileID: 1479239482}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1164828415
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1164828417}
- component: {fileID: 1164828416}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &1164828416
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1164828415}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1.2
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 2147483647
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &1164828417
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1164828415}
m_LocalRotation: {x: -0.14325272, y: -0.85669345, z: 0.35554516, w: -0.34517038}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 45.079, y: -223.89, z: 0}
--- !u!1 &1168069441
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -77216,7 +77124,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!81 &1770213883
AudioListener:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -80258,6 +80166,100 @@ MeshFilter:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1827483357}
m_Mesh: {fileID: 4300000, guid: 39e0af446885b1b42ae7c33a2a0f07c9, type: 3}
--- !u!1 &1828732313
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1828732315}
- component: {fileID: 1828732314}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &1828732314
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1828732313}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 0
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &1828732315
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1828732313}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 10.93211, y: 5.09328, z: 8.686539}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1830031208
GameObject:
m_ObjectHideFlags: 0
Expand Down
17 changes: 14 additions & 3 deletions Assets/SystemsManagement/Managers/SystemsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ public class SystemsManager : MonoBehaviour

[Header("Debug")]
public bool CalculateDebugInfo = false;
public int StatHistory = 50;

[Space(5)]
public float BeginTickTime = 0;
public float TickTime = 0;
public float EndTickTime = 0;
public float TotalTickTime = 0;
#endregion

#region Private
Expand All @@ -33,6 +35,7 @@ public class SystemsManager : MonoBehaviour
private List<float> _beginTickTimes = new List<float>();
private List<float> _tickTimes = new List<float>();
private List<float> _endTickTimes = new List<float>();
private List<float> _totalTickTimes = new List<float>();
#endregion

public void Awake()
Expand Down Expand Up @@ -65,6 +68,8 @@ public void FixedUpdate()

Stopwatch st = null;

float tick = 0.0f;

if (CalculateDebugInfo)
{
st = new Stopwatch();
Expand Down Expand Up @@ -105,7 +110,8 @@ public void FixedUpdate()
{
st.Stop();

Utils.AddToAverageList<float>(_beginTickTimes, (float)st.Elapsed.TotalMilliseconds);
tick += (float)st.Elapsed.TotalMilliseconds;
Utils.AddToAverageList<float>(_beginTickTimes, (float)st.Elapsed.TotalMilliseconds, StatHistory);

st.Reset();
st.Start();
Expand All @@ -120,7 +126,8 @@ public void FixedUpdate()
{
st.Stop();

Utils.AddToAverageList<float>(_tickTimes, (float)st.Elapsed.TotalMilliseconds);
tick += (float)st.Elapsed.TotalMilliseconds;
Utils.AddToAverageList<float>(_tickTimes, (float)st.Elapsed.TotalMilliseconds, StatHistory);

st.Reset();
st.Start();
Expand All @@ -134,11 +141,15 @@ public void FixedUpdate()
if (CalculateDebugInfo)
{
st.Stop();
Utils.AddToAverageList<float>(_endTickTimes, (float)st.Elapsed.TotalMilliseconds);

tick += (float)st.Elapsed.TotalMilliseconds;
Utils.AddToAverageList<float>(_endTickTimes, (float)st.Elapsed.TotalMilliseconds, StatHistory);
Utils.AddToAverageList<float>(_totalTickTimes, tick, StatHistory);

BeginTickTime = Utils.Average(_beginTickTimes);
TickTime = Utils.Average(_tickTimes);
EndTickTime = Utils.Average(_endTickTimes);
TotalTickTime = Utils.Average(_totalTickTimes);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/TreeGrowth/Art/Ground.mat
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ Material:
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.2735849, g: 0.2735849, b: 0.2735849, a: 1}
- _Color: {r: 0.764151, g: 0.764151, b: 0.764151, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []
Loading

0 comments on commit 95e8831

Please sign in to comment.