コード例 #1
0
ファイル: Summary.cs プロジェクト: xkcu/BenchmarkDotNet
 /// <summary>
 /// Returns a report for the given benchmark or null if there is no a corresponded report.
 /// </summary>
 public BenchmarkReport this[BenchmarkCase benchmarkCase] => reportMap.GetValueOrDefault(benchmarkCase);
コード例 #2
0
 public string GetHighlightGroupKey(BenchmarkCase benchmarkCase) => null;
コード例 #3
0
 public bool IsDefault(Summary summary, BenchmarkCase benchmarkCase) => false;
コード例 #4
0
 private static bool ShouldUseLinuxDisassembler(BenchmarkCase benchmarkCase)
 => !(benchmarkCase.Job.Environment.Runtime is MonoRuntime) && RuntimeInformation.IsLinux();
コード例 #5
0
        public String GetValue(Summary summary, BenchmarkCase benchmarkCase, SummaryStyle style)
        {
            String unit = style.PrintUnitsInContent ? " MB/s" : "";

            return(GetValue(summary, benchmarkCase) + unit);
        }
コード例 #6
0
ファイル: ORMColum.cs プロジェクト: syedbilalali/DbConnector
 public string GetValue(Summary summary, BenchmarkCase benchmarkCase, ISummaryStyle style) => GetValue(summary, benchmarkCase);
        public SynchronousProcessOutputLoggerWithDiagnoser(ILogger logger, Process process, IDiagnoser diagnoser, BenchmarkCase benchmarkCase, BenchmarkId benchmarkId, IConfig config)
        {
            if (!process.StartInfo.RedirectStandardOutput)
            {
                throw new NotSupportedException("set RedirectStandardOutput to true first");
            }
            if (!process.StartInfo.RedirectStandardInput)
            {
                throw new NotSupportedException("set RedirectStandardInput to true first");
            }

            this.logger               = logger;
            this.process              = process;
            this.diagnoser            = diagnoser;
            diagnoserActionParameters = new DiagnoserActionParameters(process, benchmarkCase, benchmarkId, config);

            LinesWithResults     = new List <string>();
            LinesWithExtraOutput = new List <string>();
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: sitrem/machinelearning
 public string GetValue(Summary summary, BenchmarkCase benchmark) => GetValue(summary, benchmark, null);
コード例 #9
0
 public string GetValue(Summary summary, BenchmarkCase benchmarkCase) => summary.IsBaseline(benchmarkCase) ? "Yes" : "No";
コード例 #10
0
ファイル: Program.cs プロジェクト: sitrem/machinelearning
 public bool IsDefault(Summary summary, BenchmarkCase benchmark) => true;
コード例 #11
0
ファイル: Program.cs プロジェクト: sitrem/machinelearning
        public string GetValue(Summary summary, BenchmarkCase benchmark, ISummaryStyle style)
        {
            var property = typeof(ClassificationMetrics).GetProperty(_metricName);

            return(property.GetValue(StochasticDualCoordinateAscentClassifierBench.s_metrics).ToString());
        }
コード例 #12
0
        }                             // we want to have only a single instance of MemoryDiagnoser

        public RunMode GetRunMode(BenchmarkCase benchmarkCase) => RunMode.NoOverhead;
コード例 #13
0
ファイル: Program.cs プロジェクト: asklar/CsWinRT
 public override bool IsSupported(BenchmarkCase benchmarkCase, ILogger logger, IResolver resolver)
 {
     return(CsProjCoreToolchain.NetCoreApp31.IsSupported(benchmarkCase, logger, resolver));
 }
コード例 #14
0
ファイル: Summary.cs プロジェクト: xkcu/BenchmarkDotNet
 public string GetLogicalGroupKey(BenchmarkCase benchmarkCase) => orderer.GetLogicalGroupKey(Config, BenchmarksCases, benchmarkCase);
コード例 #15
0
 private static BenchmarkReport CreateReport(BenchmarkCase benchmarkCase, int n, double nanoseconds)
 {
     var buildResult   = BuildResult.Success(GenerateResult.Success(ArtifactsPaths.Empty, Array.Empty <string>()));
     var executeResult = new ExecuteResult(true, 0, default, Array.Empty <string>(), new[] { $"// Runtime=extra output line" });
コード例 #16
0
        public IDiagnoser GetCompositeDiagnoser(BenchmarkCase benchmarkCase, RunMode runMode)
        {
            var diagnosersForGivenMode = diagnosers.Where(diagnoser => diagnoser.GetRunMode(benchmarkCase) == runMode).ToImmutableHashSet();

            return(diagnosersForGivenMode.Any() ? new CompositeDiagnoser(diagnosersForGivenMode) : null);
        }
コード例 #17
0
ファイル: ORMColum.cs プロジェクト: syedbilalali/DbConnector
        public string GetValue(Summary summary, BenchmarkCase benchmarkCase)
        {
            var type = benchmarkCase.Descriptor.WorkloadMethod.DeclaringType;

            return(type.GetCustomAttribute <DescriptionAttribute>()?.Description ?? type.Name.Replace("Benchmarks", string.Empty));
        }
コード例 #18
0
ファイル: TimePerNColumn.cs プロジェクト: zeta1999/VxSort
 public string GetValue(Summary summary, BenchmarkCase benchmarkCase)
 {
     return("");
 }
コード例 #19
0
 private static void Export(ILogger logger, BenchmarkCase benchmarkCase, Dictionary <HardwareCounter, (ulong withoutNoise, ulong total)> totals, IReadOnlyList <MethodWithCounters> model, HardwareCounter[] hardwareCounters)
コード例 #20
0
ファイル: ParamsSummaryColumn.cs プロジェクト: ebekker/efcore
 public string GetValue(Summary summary, BenchmarkCase benchmark) => benchmark.Parameters.DisplayInfo;
コード例 #21
0
 private static bool ShouldUseMonoDisassembler(BenchmarkCase benchmarkCase)
 => benchmarkCase.Job.Environment.Runtime is MonoRuntime || RuntimeInformation.IsMono;
コード例 #22
0
            public static void RunCore(IHost host, BenchmarkCase benchmarkCase)
            {
                var target       = benchmarkCase.Descriptor;
                var job          = benchmarkCase.Job; // TODO: filter job (same as SourceCodePresenter does)?
                int unrollFactor = benchmarkCase.Job.ResolveValue(RunMode.UnrollFactorCharacteristic, EnvironmentResolver.Instance);

                // DONTTOUCH: these should be allocated together
                var instance               = Activator.CreateInstance(benchmarkCase.Descriptor.Type);
                var workloadAction         = BenchmarkActionFactory.CreateWorkload(target, instance, unrollFactor);
                var overheadAction         = BenchmarkActionFactory.CreateOverhead(target, instance, unrollFactor);
                var globalSetupAction      = BenchmarkActionFactory.CreateGlobalSetup(target, instance);
                var globalCleanupAction    = BenchmarkActionFactory.CreateGlobalCleanup(target, instance);
                var iterationSetupAction   = BenchmarkActionFactory.CreateIterationSetup(target, instance);
                var iterationCleanupAction = BenchmarkActionFactory.CreateIterationCleanup(target, instance);
                var dummy1 = BenchmarkActionFactory.CreateDummy();
                var dummy2 = BenchmarkActionFactory.CreateDummy();
                var dummy3 = BenchmarkActionFactory.CreateDummy();

                FillMembers(instance, benchmarkCase);

                host.WriteLine();
                foreach (string infoLine in BenchmarkEnvironmentInfo.GetCurrent().ToFormattedString())
                {
                    host.WriteLine("// {0}", infoLine);
                }
                host.WriteLine("// Job: {0}", job.DisplayInfo);
                host.WriteLine();

                var engineParameters = new EngineParameters
                {
                    Host = host,
                    WorkloadActionNoUnroll = invocationCount =>
                    {
                        for (int i = 0; i < invocationCount; i++)
                        {
                            workloadAction.InvokeSingle();
                        }
                    },
                    WorkloadActionUnroll   = workloadAction.InvokeMultiple,
                    Dummy1Action           = dummy1.InvokeSingle,
                    Dummy2Action           = dummy2.InvokeSingle,
                    Dummy3Action           = dummy3.InvokeSingle,
                    OverheadActionNoUnroll = invocationCount =>
                    {
                        for (int i = 0; i < invocationCount; i++)
                        {
                            overheadAction.InvokeSingle();
                        }
                    },
                    OverheadActionUnroll   = overheadAction.InvokeMultiple,
                    GlobalSetupAction      = globalSetupAction.InvokeSingle,
                    GlobalCleanupAction    = globalCleanupAction.InvokeSingle,
                    IterationSetupAction   = iterationSetupAction.InvokeSingle,
                    IterationCleanupAction = iterationCleanupAction.InvokeSingle,
                    TargetJob           = job,
                    OperationsPerInvoke = target.OperationsPerInvoke,
                    MeasureExtraStats   = benchmarkCase.Config.HasExtraStatsDiagnoser(),
                    BenchmarkName       = FullNameProvider.GetBenchmarkName(benchmarkCase)
                };

                using (var engine = job
                                    .ResolveValue(InfrastructureMode.EngineFactoryCharacteristic, InfrastructureResolver.Instance)
                                    .CreateReadyToRun(engineParameters))
                {
                    var results = engine.Run();

                    host.ReportResults(results); // printing costs memory, do this after runs
                }
            }
コード例 #23
0
 public Boolean IsDefault(Summary summary, BenchmarkCase benchmarkCase) => false;
コード例 #24
0
        public string GetValue(Summary summary, BenchmarkCase benchmarkCase)
        {
            var type = benchmarkCase.Descriptor.WorkloadMethod.ReturnType;

            return(type == typeof(object) ? "dynamic" : type.Name);
        }
コード例 #25
0
 public string GetValue(Summary summary, BenchmarkCase benchmarkCase, SummaryStyle style)
 => Format(summary, benchmarkCase.Config, summary[benchmarkCase].ResultStatistics, style);
コード例 #26
0
 public RunMode GetRunMode(BenchmarkCase benchmarkCase) => throw new InvalidOperationException("Should never be called for Composite Diagnoser");
コード例 #27
0
 public string GetLogicalGroupKey(ImmutableArray <BenchmarkCase> allBenchmarksCases, BenchmarkCase benchmarkCase) => benchmarkCase.Descriptor.WorkloadMethodDisplayInfo;
コード例 #28
0
 private static BenchmarkReport CreateSimpleReport(BenchmarkCase benchmarkCase) => CreateReport(benchmarkCase, 1, 1);
コード例 #29
0
 public string GetValue(Summary summary, BenchmarkCase benchmarkCase) => getTag(benchmarkCase.Descriptor.WorkloadMethod.Name);
コード例 #30
0
ファイル: Summary.cs プロジェクト: xkcu/BenchmarkDotNet
 [PublicAPI] public bool HasReport(BenchmarkCase benchmarkCase) => reportMap.ContainsKey(benchmarkCase);