Ejemplo n.º 1
0
        public BenchmarksController()
        {
            string root          = HostingEnvironment.ApplicationPhysicalPath;
            string benchmarkData = Path.Combine(root, "benchmarkdata");

            repositoryWatcher = new FileWatchingReloader <BenchmarkRepository>(
                Path.Combine(benchmarkData, "index.txt"),
                () => BenchmarkRepository.Load(benchmarkData),
                ReloadTime);
            string logFile = Path.Combine(root, "hg-log.xml");

            logWatcher = new FileWatchingReloader <MercurialLog>(logFile, () => MercurialLog.Load(logFile), ReloadTime);
        }
Ejemplo n.º 2
0
        public BenchmarkDiff(BenchmarkRun left, BenchmarkRun right, MercurialLog log)
        {
            Left = left;
            Right = right;
            LeftOnly = left.Results.ExceptBy(right.Results, result => result.FullyQualifiedMethod);
            RightOnly = right.Results.ExceptBy(left.Results, result => result.FullyQualifiedMethod);

            var pairs = (from l in left.Results
                         join r in right.Results on l.FullyQualifiedMethod equals r.FullyQualifiedMethod
                         select new BenchmarkPair(l, r)).ToList();

            LeftBetter = pairs.Where(pair => pair.Percent < ImprovementThreshold).ToList();
            RightBetter = pairs.Where(pair => pair.Percent > RegressionThreshold).ToList();

            var earlier = left.StartTime < right.StartTime ? left : right;
            var later = left.StartTime < right.StartTime ? right : left;

            var earlierHash = BenchmarkRepository.HashForLabel(earlier.Label);
            var laterHash = BenchmarkRepository.HashForLabel(later.Label);
            LogEntries = log.EntriesBetween(earlierHash, laterHash).ToList();
        }
        public TrivialDependencyResolver()
        {
            string root          = HostingEnvironment.ApplicationPhysicalPath;
            string benchmarkData = Path.Combine(root, "benchmarkdata");

            /*
             * repositoryWatcher = new FileWatchingReloader<BenchmarkRepository>(
             *  Path.Combine(benchmarkData, "index.txt"),
             *  () => BenchmarkRepository.Load(benchmarkData),
             *  ReloadTime);*/
            repositoryWatcher = new FileWatchingReloader <BenchmarkRepository>(
                Path.Combine(benchmarkData, "benchmarks.xml"),
                () => BenchmarkRepository.LoadSingleFile(Path.Combine(benchmarkData, "benchmarks.xml")),
                ReloadTime);
            string hgLogFile  = Path.Combine(root, "hg-log.xml");
            string gitLogFile = Path.Combine(root, "git-log.txt");
            var    hgWatcher  = new FileWatchingReloader <ImmutableList <SourceLogEntry> >(hgLogFile, () => MercurialLog.Load(hgLogFile), ReloadTime);
            var    gitWatcher = new FileWatchingReloader <ImmutableList <SourceLogEntry> >(gitLogFile, () => GitLog.Load(gitLogFile), ReloadTime);

            logWatcher = new CombiningReloader <ImmutableList <SourceLogEntry> >(new[] { hgWatcher, gitWatcher }.ToImmutableList(), logs => logs.SelectMany(x => x).OrderByDescending(x => x.Date).ToImmutableList());
        }