private static ExperimentManager NewManager()
        {
            ReferenceExperiment reference = new ReferenceExperiment(
                ExperimentDefinition.Create("LinearEquationSolver.exe", ExperimentDefinition.LocalDiskContainerUri, "reference", "csv", "{0} 10", TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(0), "default"),
                1, 0.17);
            ExperimentManager manager = LocalExperimentManager.NewExperiments("measure" + Guid.NewGuid(), reference, domainResolver);

            return(manager);
        }
Beispiel #2
0
        private static ReferenceExperiment ParseReferenceExperiment(string filename)
        {
            string content = File.ReadAllText(filename);
            JsonSerializerSettings settings = new JsonSerializerSettings();

            settings.ContractResolver = new PrivatePropertiesResolver();
            ReferenceExperiment reference = JsonConvert.DeserializeObject <ReferenceExperiment>(content, settings);

            return(reference);
        }
Beispiel #3
0
        public async Task <ReferenceExperiment> GetReferenceExperiment()
        {
            var blob = configContainer.GetBlockBlobReference("reference.json");

            try
            {
                string content = await blob.DownloadTextAsync();

                JsonSerializerSettings settings = new JsonSerializerSettings();
                settings.ContractResolver = new PrivatePropertiesResolver();
                ReferenceExperiment reference = JsonConvert.DeserializeObject <ReferenceExperiment>(content, settings);
                return(reference);
            }
            catch (StorageException ex)
            {
                if (ex.RequestInformation.HttpStatusCode == 404) // Not found
                {
                    return(null);
                }
                throw;
            }
        }
Beispiel #4
0
        static int Main(string[] args)
        {
            if (args.Length < 5 || args.Length > 7)
            {
                return(PrintSyntax());
            }

            int  k    = 0;
            bool init = false;

            if (args[k] == "--init")
            {
                if (args.Length != 7)
                {
                    return(PrintSyntax());
                }
                init = true;
                k++;
            }
            else
            {
                if (args.Length != 5)
                {
                    return(PrintSyntax());
                }
            }

            string executable            = args[k++];
            string arguments             = args[k++];
            string benchmarkContainerUri = ExperimentDefinition.LocalDiskContainerUri;
            string benchmarkDirectory    = args[k++];
            string category  = args[k++];
            string extension = args[k++];

            int    repetitions    = 1;
            double referenceValue = 1.0;

            if (init)
            {
                repetitions = int.Parse(args[k++], CultureInfo.InvariantCulture);
            }

            TimeSpan             timeout    = TimeSpan.FromHours(1);
            ExperimentDefinition definition = ExperimentDefinition.Create(executable, benchmarkContainerUri, benchmarkDirectory, extension, arguments, timeout, TimeSpan.FromSeconds(0), Measurement.Domain.Default.Name, category: category);
            string version = GetVersion(executable);

            if (init)
            {
                Print(String.Format("Initializing environment..."));
            }
            else
            {
                Print(String.Format("Measuring performance of {0} {1}...\n", executable, version));
            }

            IDomainResolver domainResolver = new DomainResolver(new[] { Measurement.Domain.Default });

            if (init)
            {
                var reference             = new ReferenceExperiment(definition, repetitions, referenceValue);
                ExperimentManager manager = LocalExperimentManager.NewExperiments("measure", reference, domainResolver);
            }
            else
            {
                ExperimentManager manager = LocalExperimentManager.OpenExperiments("measure", domainResolver);
                Run(manager, definition).Wait();
            }

            return(0);
        }
        public static async Task <AzureExperimentManager> New(AzureExperimentStorage storage, ReferenceExperiment reference, string batchUrl, string batchAccName, string batchKey)
        {
            await storage.SaveReferenceExperiment(reference);

            return(new AzureExperimentManager(storage, batchUrl, batchAccName, batchKey));
        }
Beispiel #6
0
 public async Task SaveReferenceExperiment(ReferenceExperiment reference)
 {
     string json = JsonConvert.SerializeObject(reference, Formatting.Indented);
     var    blob = configContainer.GetBlockBlobReference("reference.json");
     await blob.UploadTextAsync(json);
 }