Exemplo n.º 1
0
        public CSVBenchmarkReporter(DCEPSettings settings, NodeName nodeName)
        {
            this.settings = settings;
            filepath      = Path.Combine(directory, Path.GetFileName(settings.experimentName + "-" + nodeName + ".csv"));

            this.nodeName = nodeName;
        }
Exemplo n.º 2
0
        public SimulationEnvironment(string[] inputlines, DCEPSettings settings)
        {
            this.nodedict  = new Dictionary <NodeName, DCEPNode>();
            this.proxydict = new Dictionary <NodeName, IAmbrosiaNodeProxy>();

            ExecutionPlan executionPlan = new ExecutionPlan(inputlines);

            Console.WriteLine(executionPlan.generateHumanReadableString());

            foreach (var item in executionPlan.networkPlan)
            {
                DCEPNode node = new DCEPNode(item.Key, inputlines, settings);
                nodedict.Add(item.Key, node);
                proxydict.Add(item.Key, new SimulatedAmbrosiaSelfProxy(node));
            }

            foreach (var item in nodedict)
            {
                item.Value.onFirstStart((INodeProxyProvider)this);
                new Thread(item.Value.threadStartMethod).Start();
            }


            if (settings.duration == 0)
            {
                Console.WriteLine("[SimulationEnvironment] Running indefinitly. Press enter to terminate all nodes immediately.");
                Console.ReadLine();
                (nodedict[settings.directorNodeName] as DCEPNode).terminateImmediately();
            }
        }
Exemplo n.º 3
0
        public TestEnvorioment(string[] inputlines, DCEPSettings settings)
        {
            this.nodedict  = new Dictionary <NodeName, DCEPNode>();
            this.proxydict = new Dictionary <NodeName, IAmbrosiaNodeProxy>();

            ExecutionPlan executionPlan = new ExecutionPlan(inputlines);

            Console.WriteLine(executionPlan.generateHumanReadableString());

            foreach (var item in executionPlan.networkPlan)
            {
                DCEPNode node = new DCEPNode(item.Key, inputlines, settings);
                nodedict.Add(item.Key, node);
                proxydict.Add(item.Key, new SimulatedAmbrosiaSelfProxy(node));
            }

            foreach (var item in nodedict)
            {
                item.Value.onFirstStart((INodeProxyProvider)this);
                new Thread(item.Value.threadStartMethod).Start();
            }

            Console.WriteLine("[TestEnvironment] Running.");
        }
Exemplo n.º 4
0
        internal static IEnumerable <BenchmarkReporter> createInstances(IEnumerable <BenchmarkReporterName> reporterNames, DCEPSettings settings, NodeName nodeName)
        {
            if (reporterNames == null)
            {
                return(Enumerable.Empty <BenchmarkReporter>());
            }

            var uniquereporters = reporterNames.ToImmutableHashSet();

            var result = new List <BenchmarkReporter>();

            foreach (var name in uniquereporters)
            {
                switch (name)
                {
                case BenchmarkReporterName.CSV:
                    result.Add(new CSVBenchmarkReporter(settings, nodeName));
                    break;

                default:
                    continue;
                }
            }

            return(result);
        }
Exemplo n.º 5
0
 public BenchmarkMeter(DCEPSettings settings, NodeName nodeName)
 {
     this.reportIntervalInMilliseconds = settings.benchmarkIntervalInSeconds * 1000;
     this.reporters = BenchmarkReporter.createInstances(settings.benchmarkReporterNames, settings, nodeName);
 }