// Token: 0x0600058A RID: 1418 RVA: 0x0001B907 File Offset: 0x00019B07 private global::System.Collections.IEnumerator MeasureFramerate(int sampleCount) { yield return(new global::UnityEngine.WaitForSeconds(0.01f)); long[] samples = new long[sampleCount]; yield return(null); global::System.Diagnostics.Stopwatch stopwatch = new global::System.Diagnostics.Stopwatch(); stopwatch.Start(); int num; for (int i = 0; i < sampleCount; i = num + 1) { stopwatch.Reset(); stopwatch.Start(); yield return(null); samples[i] = stopwatch.ElapsedMilliseconds; num = i; } this._CurrentInterval = global::System.Linq.Enumerable.Average(samples); yield return(new global::UnityEngine.WaitForSeconds(0.01f)); yield break; }
static Clock() { Clock._watch = global::System.Diagnostics.Stopwatch.StartNew(); }
/* * This is not a Mono bug. * * By default, only 127.0.0.1 is enabled and you must explicitly * enable additional addresses using 'sudo ifconfig lo0 alias 127.0.0.1'. * * I tested this on Mac OS 10.7.4; a 'ping 127.0.0.2' does not work * until I add that alias. * */ public void BeginConnectMultiple () { Socket sock = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Socket listen = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 1246); IPAddress[] ips = new IPAddress[4]; ips[0] = IPAddress.Parse ("127.0.0.4"); ips[1] = IPAddress.Parse ("127.0.0.3"); ips[2] = IPAddress.Parse ("127.0.0.2"); ips[3] = IPAddress.Parse ("127.0.0.1"); listen.Bind (ep); listen.Listen (1); BCCalledBack.Reset (); BCConnected = false; sock.BeginConnect (ips, 1246, BCCallback, sock); /* Longer wait here, because the ms runtime * takes a lot longer to not connect */ /* if (BCCalledBack.WaitOne (30000, false) == false) { Assert.Fail ("BeginConnectMultiple wait failed"); } */ var sw = new global::System.Diagnostics.Stopwatch (); sw.Start (); BCCalledBack.WaitOne (); sw.Stop (); Console.WriteLine (sw.ElapsedMilliseconds); if (sw.ElapsedMilliseconds > 30000) Assert.Fail ("BeginConnectMultiple wait failed"); Assert.AreEqual (true, BCConnected, "BeginConnectMultiple #1"); Assert.AreEqual (AddressFamily.InterNetwork, sock.RemoteEndPoint.AddressFamily, "BeginConnectMultiple #2"); IPEndPoint remep = (IPEndPoint)sock.RemoteEndPoint; Assert.AreEqual (IPAddress.Loopback, remep.Address, "BeginConnectMultiple #2"); sock.Close (); listen.Close (); }