From 5d5637143b8816198fb78030556206a901e4a285 Mon Sep 17 00:00:00 2001 From: ikpil Date: Fri, 24 Mar 2023 10:58:11 +0900 Subject: [PATCH] fix - ticks to millis --- src/DotRecast.Recast.Demo/RecastDemo.cs | 6 +++--- src/DotRecast.Recast.Demo/Tools/CrowdProfilingTool.cs | 2 +- src/DotRecast.Recast.Demo/Tools/CrowdTool.cs | 2 +- src/DotRecast.Recast.Demo/Tools/DynamicUpdateTool.cs | 6 +++--- src/DotRecast.Recast/Telemetry.cs | 2 +- test/DotRecast.Detour.Test/RandomPointTest.cs | 4 ++-- test/DotRecast.Detour.TileCache.Test/TileCacheTest.cs | 4 ++-- test/DotRecast.Recast.Test/RecastSoloMeshTest.cs | 4 ++-- test/DotRecast.Recast.Test/RecastTileMeshTest.cs | 4 ++-- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/DotRecast.Recast.Demo/RecastDemo.cs b/src/DotRecast.Recast.Demo/RecastDemo.cs index ac159d6..86f29db 100644 --- a/src/DotRecast.Recast.Demo/RecastDemo.cs +++ b/src/DotRecast.Recast.Demo/RecastDemo.cs @@ -507,8 +507,8 @@ public class RecastDemo cameraPos[1] += (float)((_moveUp - _moveDown) * keySpeed * dt); - // long time = Stopwatch.GetTimestamp() / 1000; - // //float dt = (time - prevFrameTime) / 1000000.0f; + // long time = Stopwatch.GetTimestamp(); + // //float dt = (time - prevFrameTime) / TimeSpan.TicksPerMillisecond; // prevFrameTime = time; // // // Update sample simulation. @@ -605,7 +605,7 @@ public class RecastDemo sample.update(sample.getInputGeom(), buildResult.Item1, buildResult.Item2); sample.setChanged(false); - settingsUI.setBuildTime((Stopwatch.GetTimestamp() - t) / 1_000_000); + settingsUI.setBuildTime((Stopwatch.GetTimestamp() - t) / TimeSpan.TicksPerMicrosecond); toolsUI.setSample(sample); } } diff --git a/src/DotRecast.Recast.Demo/Tools/CrowdProfilingTool.cs b/src/DotRecast.Recast.Demo/Tools/CrowdProfilingTool.cs index cc47856..2eed2c3 100644 --- a/src/DotRecast.Recast.Demo/Tools/CrowdProfilingTool.cs +++ b/src/DotRecast.Recast.Demo/Tools/CrowdProfilingTool.cs @@ -271,7 +271,7 @@ public class CrowdProfilingTool } } - crowdUpdateTime = (endTime - startTime) / 1_000_000; + crowdUpdateTime = (endTime - startTime) / TimeSpan.TicksPerMicrosecond; } private void moveMob(NavMeshQuery navquery, QueryFilter filter, CrowdAgent ag, AgentData agentData) diff --git a/src/DotRecast.Recast.Demo/Tools/CrowdTool.cs b/src/DotRecast.Recast.Demo/Tools/CrowdTool.cs index 612233c..5a07803 100644 --- a/src/DotRecast.Recast.Demo/Tools/CrowdTool.cs +++ b/src/DotRecast.Recast.Demo/Tools/CrowdTool.cs @@ -676,7 +676,7 @@ public class CrowdTool : Tool m_agentDebug.vod.normalizeSamples(); // m_crowdSampleCount.addSample((float) crowd.getVelocitySampleCount()); - crowdUpdateTime = (endTime - startTime) / 1_000_000; + crowdUpdateTime = (endTime - startTime) / TimeSpan.TicksPerMicrosecond; } private void hilightAgent(CrowdAgent agent) diff --git a/src/DotRecast.Recast.Demo/Tools/DynamicUpdateTool.cs b/src/DotRecast.Recast.Demo/Tools/DynamicUpdateTool.cs index 7bc3839..04807d4 100644 --- a/src/DotRecast.Recast.Demo/Tools/DynamicUpdateTool.cs +++ b/src/DotRecast.Recast.Demo/Tools/DynamicUpdateTool.cs @@ -183,7 +183,7 @@ public class DynamicUpdateTool : Tool long t1 = Stopwatch.GetTimestamp(); float? hitPos = dynaMesh.voxelQuery().raycast(sp, ep); long t2 = Stopwatch.GetTimestamp(); - raycastTime = (t2 - t1) / 1_000_000L; + raycastTime = (t2 - t1) / TimeSpan.TicksPerMicrosecond; raycastHit = hitPos.HasValue; raycastHitPos = hitPos.HasValue ? new float[] { sp[0] + hitPos.Value * (ep[0] - sp[0]), sp[1] + hitPos.Value * (ep[1] - sp[1]), sp[2] + hitPos.Value * (ep[2] - sp[2]) } @@ -468,7 +468,7 @@ public class DynamicUpdateTool : Tool bool updated = dynaMesh.update(executor).Result; if (updated) { - buildTime = (Stopwatch.GetTimestamp() - t) / 1_000_000; + buildTime = (Stopwatch.GetTimestamp() - t) / TimeSpan.TicksPerMicrosecond; sample.update(null, dynaMesh.recastResults(), dynaMesh.navMesh()); sample.setChanged(false); } @@ -720,7 +720,7 @@ public class DynamicUpdateTool : Tool Console.WriteLine(e); } - buildTime = (Stopwatch.GetTimestamp() - t) / 1_000_000; + buildTime = (Stopwatch.GetTimestamp() - t) / TimeSpan.TicksPerMicrosecond; sample.update(null, dynaMesh.recastResults(), dynaMesh.navMesh()); } diff --git a/src/DotRecast.Recast/Telemetry.cs b/src/DotRecast.Recast/Telemetry.cs index 9f857bf..3519576 100644 --- a/src/DotRecast.Recast/Telemetry.cs +++ b/src/DotRecast.Recast/Telemetry.cs @@ -51,7 +51,7 @@ namespace DotRecast.Recast { foreach (var (n, v) in timerAccum) { - Console.WriteLine(n + ": " + v.Read() / 1000000); + Console.WriteLine(n + ": " + v.Read() / TimeSpan.TicksPerMillisecond); } } } diff --git a/test/DotRecast.Detour.Test/RandomPointTest.cs b/test/DotRecast.Detour.Test/RandomPointTest.cs index d118f92..b7bea0e 100644 --- a/test/DotRecast.Detour.Test/RandomPointTest.cs +++ b/test/DotRecast.Detour.Test/RandomPointTest.cs @@ -133,7 +133,7 @@ public class RandomPointTest : AbstractDetourTest } long t3 = Stopwatch.GetTimestamp(); - Console.WriteLine("Random point around circle: " + (t2 - t1) / 1000000 + "ms"); - Console.WriteLine("Random point within circle: " + (t3 - t2) / 1000000 + "ms"); + Console.WriteLine("Random point around circle: " + (t2 - t1) / TimeSpan.TicksPerMillisecond + "ms"); + Console.WriteLine("Random point within circle: " + (t3 - t2) / TimeSpan.TicksPerMillisecond + "ms"); } } \ No newline at end of file diff --git a/test/DotRecast.Detour.TileCache.Test/TileCacheTest.cs b/test/DotRecast.Detour.TileCache.Test/TileCacheTest.cs index f768ead..3d417ef 100644 --- a/test/DotRecast.Detour.TileCache.Test/TileCacheTest.cs +++ b/test/DotRecast.Detour.TileCache.Test/TileCacheTest.cs @@ -202,8 +202,8 @@ public class TileCacheTest : AbstractTileCacheTest } long t3 = Stopwatch.GetTimestamp(); - Console.WriteLine(" Time ST : " + (t2 - t1) / 1000000); - Console.WriteLine(" Time MT : " + (t3 - t2) / 1000000); + Console.WriteLine(" Time ST : " + (t2 - t1) / TimeSpan.TicksPerMillisecond); + Console.WriteLine(" Time MT : " + (t3 - t2) / TimeSpan.TicksPerMillisecond); TileCache tc = getTileCache(geom, order, cCompatibility); foreach (byte[] layer in layers) { diff --git a/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs b/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs index b9b0573..413b733 100644 --- a/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs +++ b/test/DotRecast.Recast.Test/RecastSoloMeshTest.cs @@ -257,8 +257,8 @@ public class RecastSoloMeshTest Assert.That(m_dmesh.nverts, Is.EqualTo(expDetVerts), "Mesh Detail Verts"); Assert.That(m_dmesh.ntris, Is.EqualTo(expDetTris), "Mesh Detail Tris"); long time2 = Stopwatch.GetTimestamp(); - Console.WriteLine(filename + " : " + partitionType + " " + (time2 - time) / 1000000 + " ms"); - Console.WriteLine(" " + (time3 - time) / 1000000 + " ms"); + Console.WriteLine(filename + " : " + partitionType + " " + (time2 - time) / TimeSpan.TicksPerMillisecond + " ms"); + Console.WriteLine(" " + (time3 - time) / TimeSpan.TicksPerMillisecond + " ms"); saveObj(filename.Substring(0, filename.LastIndexOf('.')) + "_" + partitionType + "_detail.obj", m_dmesh); saveObj(filename.Substring(0, filename.LastIndexOf('.')) + "_" + partitionType + ".obj", m_pmesh); m_ctx.print(); diff --git a/test/DotRecast.Recast.Test/RecastTileMeshTest.cs b/test/DotRecast.Recast.Test/RecastTileMeshTest.cs index 970ef66..f8f0182 100644 --- a/test/DotRecast.Recast.Test/RecastTileMeshTest.cs +++ b/test/DotRecast.Recast.Test/RecastTileMeshTest.cs @@ -119,8 +119,8 @@ public class RecastTileMeshTest } long t3 = Stopwatch.GetTimestamp(); - Console.WriteLine(" Time ST : " + (t2 - t1) / 1000000); - Console.WriteLine(" Time MT : " + (t3 - t2) / 1000000); + Console.WriteLine(" Time ST : " + (t2 - t1) / TimeSpan.TicksPerMillisecond); + Console.WriteLine(" Time MT : " + (t3 - t2) / TimeSpan.TicksPerMillisecond); } private void build(InputGeomProvider geom, RecastBuilder builder, RecastConfig cfg, int threads, bool validate)