Exemplo n.º 1
0
        public void BuildExperimentsSummary()
        {
            var domain = new Z3Domain();

            var benchmarkResults1 = Enumerable.Concat(BuildResults(1, 3, "a"), BuildResults(1, 2, "b"));
            var catSummary1       = ExperimentSummary.Build(benchmarkResults1, domain);

            Assert.AreEqual(2, catSummary1.Count, "2 categories");
            AssertCatSummary(3, catSummary1["a"]);
            AssertCatSummary(2, catSummary1["b"]);

            Table table0             = Table.Empty;
            var   experimentSummary1 = new ExperimentSummary(1, DateTimeOffset.Now, catSummary1);
            Table table1             = ExperimentSummaryStorage.AppendOrReplace(table0, experimentSummary1);

            var benchmarkResults2 = Enumerable.Concat(BuildResults(1, 3, "b"), BuildResults(1, 2, "c"));
            var catSummary2       = ExperimentSummary.Build(benchmarkResults2, domain);

            var   experimentSummary2 = new ExperimentSummary(2, DateTimeOffset.Now, catSummary2);
            Table table2             = ExperimentSummaryStorage.AppendOrReplace(table1, experimentSummary2);

            Assert.IsTrue(table2.Count >= 2 + 3 * (5 + 8), "Number of columns");
            Assert.AreEqual(2, table2.RowsCount, "Number of rows");

            AreEqualArrays(new[] { "1", "2" }, table2["ID"].Rows.AsString.ToArray());
            AreEqualArrays(new[] { "3", "" }, table2["a|SAT"].Rows.AsString.ToArray());
            AreEqualArrays(new[] { "2", "3" }, table2["b|SAT"].Rows.AsString.ToArray());
            AreEqualArrays(new[] { "", "2" }, table2["c|SAT"].Rows.AsString.ToArray());
        }
Exemplo n.º 2
0
        public async Task <ExperimentSummary[]> Update(string timelineName, params int[] experiments)
        {
            if (experiments == null)
            {
                throw new ArgumentNullException(nameof(experiments));
            }

            Trace.WriteLine("Downloading experiment results...");
            var all_summaries = await DownloadSummary(timelineName);

            Table        timeline = all_summaries.Item1;
            RecordsTable records  = all_summaries.Item2;
            string       etag     = all_summaries.Item3;

            foreach (var experimentId in experiments)
            {
                var exp = await storage.GetExperiment(experimentId); // fails if not found

                var domain = resolveDomain.GetDomain(exp.DomainName);

                var results = (await storage.GetResults(experimentId)).Benchmarks;

                Trace.WriteLine("Building summary for the experiment " + experimentId);
                var catSummary = ExperimentSummary.Build(results, domain, ExperimentSummary.DuplicateResolution.Ignore);
                var expSummary = new ExperimentSummary(experimentId, DateTimeOffset.Now, catSummary);
                timeline = ExperimentSummaryStorage.AppendOrReplace(timeline, expSummary);

                Trace.WriteLine("Updating records...");
                records.UpdateWith(results, domain);
            }

            await UploadSummary(timelineName, timeline, records, all_summaries.Item3);

            var resultfromTable = ExperimentSummaryStorage.LoadFromTable(timeline);

            Array.Sort(resultfromTable, (el1, el2) => DateTimeOffset.Compare(el2.Date, el1.Date));
            return(resultfromTable);
        }