public CounterController( ILogger <CounterController> logger, PersistentCounter persistentCounter) { _logger = logger; _counter = persistentCounter; _jsonSettings = new JsonSerializerSettings(); _jsonSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); }
// Start is called before the first frame update void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this); } else if (instance != this) { DestroyImmediate(this); } }
static void Main(string[] args) { var rnd = new Random(); var graph1 = new GraphProperties(10.Pow(4), 10.Pow(5), 10.Pow(3)); var graph2 = new GraphProperties(10.Pow(4), 10.Pow(6), 10.Pow(4)); var graph3 = new GraphProperties(10.Pow(5), 10.Pow(6), 10.Pow(4)); var graph4 = new GraphProperties(10.Pow(5), 10.Pow(7), 10.Pow(5)); var graph5 = new GraphProperties(10.Pow(5), 10.Pow(7), 10.Pow(5)); var graphs = new[] { graph4 }; var incrementalSolver = new IncrementalTriangleCounting(); var edgeIteratorSolver = new EdgeIteratorTriangleCounting(); var nodeIteratorSolver = new NodeIteratorTriangleCounting(); var persistentSolver = PersistentCounter.Create(); var solvers = new TriangleCountingSolver[] { incrementalSolver, edgeIteratorSolver, nodeIteratorSolver, persistentSolver }; foreach (var graphProperties in graphs) { var graph = graphProperties.Generate(rnd); Console.WriteLine(graphProperties + ":"); foreach (var solver in solvers) { var benchmarkResults = solver.Benchmark(graph); Console.WriteLine("\t" + solver.SolverName + ": " + benchmarkResults); } } var n = 10.Pow(6); /*for (int m = 1000; m <= 10000000; m += m) * { * var p = new GraphProperties(n, m, 0); * var graph = p.Generate(rnd); * Console.Write("m = " + m + ": \t"); * Console.Write(new IncrementalTriangleCounting().Benchmark(graph).AverageMsTimePerOperation.TotalMilliseconds + "ms \t"); * Console.Write(PersistentCounter.Create().Benchmark(graph).AverageMsTimePerOperation.TotalMilliseconds + "ms"); * * Console.WriteLine(); * }*/ }
internal static void RecordEventOccurrence(string eventName, string category) { Contract.Requires(!String.IsNullOrEmpty(eventName)); // In release builds, just quietly return. if (string.IsNullOrEmpty(eventName)) { return; } if (Enabled && Configuration.IncludeEventStatistics) { PersistentCounter counter; lock (events) { if (!events.TryGetValue(eventName, out counter)) { events[eventName] = counter = new PersistentCounter(file, "event-" + SanitizeFileName(eventName) + ".txt"); } } counter.Increment(category); Touch(); } }
internal static void RecordEventOccurrence(string eventName, string category) { Contract.Requires(!String.IsNullOrEmpty(eventName)); // In release builds, just quietly return. if (string.IsNullOrEmpty(eventName)) { return; } if (Enabled && Configuration.IncludeEventStatistics) { PersistentCounter counter; lock (events) { if (!events.TryGetValue(eventName, out counter)) { events[eventName] = counter = new PersistentCounter(file, "event-" + SanitizeFileName(eventName) + ".txt"); } } counter.Increment(category); Touch(); } }