bool NodeInactive( DestinationStatistics d, float avg, float stddev) { var result = (d.FailedTunnelTest > 8 && d.FailedTunnelTest > 3 * d.SuccessfulTunnelTest) || (d.FailedConnects > 5 && d.FailedConnects > 3 * d.SuccessfulConnects); return(result); }
public void Load() { using (var s = GetStore()) { var readsw = new Stopwatch(); var constrsw = new Stopwatch(); var dicsw = new Stopwatch(); var sw2 = new Stopwatch(); sw2.Start(); var ix = 0; while ((ix = s.Next(ix)) > 0) { readsw.Start(); var data = s.Read(ix); readsw.Stop(); var reader = new BufRefLen(data); switch ((StoreRecordId)reader.Read32()) { case StoreRecordId.DestinationStatistics: constrsw.Start(); var one = new DestinationStatistics(reader); constrsw.Stop(); dicsw.Start(); Destinations[one.Id] = one; dicsw.Stop(); one.StoreIx = ix; break; default: s.Delete(ix); break; } } sw2.Stop(); Logging.Log($"Statistics load: Total: {sw2.Elapsed}, " + $"Read(): {readsw.Elapsed}, Constr: {constrsw.Elapsed}, " + $"Dict: {dicsw.Elapsed} "); // var times = Destinations.Select( d => d.Value.TunnelBuildTimeMsPerHop.ToString() ); // System.IO.File.WriteAllLines( "/tmp/ct.txt", times ); } }
public void Load() { using (var s = GetStore()) { var readsw = new Stopwatch(); var constrsw = new Stopwatch(); var dicsw = new Stopwatch(); var sw2 = new Stopwatch(); sw2.Start(); var ix = 0; while ((ix = s.Next(ix)) > 0) { readsw.Start(); var data = s.Read(ix); readsw.Stop(); var reader = new BufRefLen(data); switch ((StoreRecordId)reader.Read32()) { case StoreRecordId.DestinationStatistics: constrsw.Start(); var one = new DestinationStatistics(reader); constrsw.Stop(); dicsw.Start(); Destinations[one.Id] = one; dicsw.Stop(); one.StoreIx = ix; break; default: s.Delete(ix); break; } } sw2.Stop(); DebugUtils.Log(string.Format("Statistics load: Total: {0}, Read(): {1}, Constr: {2}, Dict: {3} ", sw2.Elapsed, readsw.Elapsed, constrsw.Elapsed, dicsw.Elapsed)); } }
public DestinationStatistics this[I2PIdentHash ix] { get { lock ( Destinations ) { DestinationStatistics stat; if (!Destinations.ContainsKey(ix)) { stat = new DestinationStatistics(ix); Destinations[ix] = stat; } else { stat = Destinations[ix]; } return(stat); } } }