protected HostEnvironmentInfo()
 {
     BenchmarkDotNetVersion = GetBenchmarkDotNetVersion();
     OsVersion            = new Lazy <string>(RuntimeInformation.GetOsVersion);
     ProcessorName        = new Lazy <string>(RuntimeInformation.GetProcessorName);
     ProcessorCount       = Environment.ProcessorCount;
     ChronometerFrequency = Chronometer.Frequency;
     HardwareTimerKind    = Chronometer.HardwareTimerKind;
     JitModules           = RuntimeInformation.GetJitModulesInfo();
     DotNetCliVersion     = new Lazy <string>(DotNetCliCommandExecutor.GetDotNetCliVersion);
 }
 private HostEnvironmentInfo()
 {
     BenchmarkDotNetCaption = GetBenchmarkDotNetCaption();
     BenchmarkDotNetVersion = GetBenchmarkDotNetVersion();
     OsVersion = RuntimeInformation.GetOsVersion();
     ProcessorName = new Lazy<string>(RuntimeInformation.GetProcessorName);
     ProcessorCount = System.Environment.ProcessorCount;
     ChronometerFrequency = Chronometer.Frequency;
     HardwareTimerKind = Chronometer.HardwareTimerKind;
     JitModules = RuntimeInformation.GetJitModules();
     DotNetCliVersion = new Lazy<string>(DotNetCliCommandExecutor.GetDotNetCliVersion);
 }
Example #3
0
 private EnvironmentInfo()
 {
     BenchmarkDotNetCaption = GetBenchmarkDotNetCaption();
     BenchmarkDotNetVersion = GetBenchmarkDotNetVersion();
     OsVersion            = RuntimeInformation.GetOsVersion();
     ProcessorName        = RuntimeInformation.GetProcessorName();
     ProcessorCount       = Environment.ProcessorCount;
     ClrVersion           = RuntimeInformation.GetClrVersion();
     Architecture         = GetArchitecture();
     HasAttachedDebugger  = Debugger.IsAttached;
     HasRyuJit            = RuntimeInformation.HasRyuJit();
     Configuration        = RuntimeInformation.GetConfiguration();
     ChronometerFrequency = Chronometer.Frequency;
     JitModules           = RuntimeInformation.GetJitModules();
     HardwareTimerKind    = Chronometer.HardwareTimerKind;
     DotNetCliVersion     = new Lazy <string>(DotNetCliCommandExecutor.GetDotNetCliVersion);
 }
 private EnvironmentInfo()
 {
     BenchmarkDotNetCaption = GetBenchmarkDotNetCaption();
     BenchmarkDotNetVersion = GetBenchmarkDotNetVersion();
     OsVersion = RuntimeInformation.GetOsVersion();
     ProcessorName = RuntimeInformation.GetProcessorName();
     ProcessorCount = Environment.ProcessorCount;
     ClrVersion = RuntimeInformation.GetClrVersion();
     Architecture = GetArchitecture();
     HasAttachedDebugger = Debugger.IsAttached;
     HasRyuJit = RuntimeInformation.HasRyuJit();
     Configuration = RuntimeInformation.GetConfiguration();
     ChronometerFrequency = Chronometer.Frequency;
     JitModules = RuntimeInformation.GetJitModules();
     HardwareTimerKind = Chronometer.HardwareTimerKind;
     DotNetCliVersion = new Lazy<string>(DotNetCliCommandExecutor.GetDotNetCliVersion);
 }
 public MockHostEnvironmentInfo(
     string architecture, string benchmarkDotNetVersion, Frequency chronometerFrequency, string configuration, string dotNetSdkVersion,
     HardwareTimerKind hardwareTimerKind, bool hasAttachedDebugger, bool hasRyuJit, bool isConcurrentGC, bool isServerGC,
     string jitInfo, string jitModules, string osVersion, CpuInfo cpuInfo,
     string runtimeVersion, VirtualMachineHypervisor virtualMachineHypervisor)
 {
     Architecture           = architecture;
     BenchmarkDotNetVersion = benchmarkDotNetVersion;
     ChronometerFrequency   = chronometerFrequency;
     Configuration          = configuration;
     DotNetSdkVersion       = new Lazy <string>(() => dotNetSdkVersion);
     HardwareTimerKind      = hardwareTimerKind;
     HasAttachedDebugger    = hasAttachedDebugger;
     HasRyuJit                = hasRyuJit;
     IsConcurrentGC           = isConcurrentGC;
     IsServerGC               = isServerGC;
     JitInfo                  = jitInfo;
     OsVersion                = new Lazy <string>(() => osVersion);
     CpuInfo                  = new Lazy <CpuInfo>(() => cpuInfo);
     RuntimeVersion           = runtimeVersion;
     VirtualMachineHypervisor = new Lazy <VirtualMachineHypervisor>(() => virtualMachineHypervisor);
 }
Example #6
0
        public override IEnumerable <string> ToFormattedString()
        {
            string vmName = VirtualMachineHypervisor.Value?.Name;

            if (!string.IsNullOrEmpty(vmName))
            {
                yield return($"{BenchmarkDotNetCaption}=v{BenchmarkDotNetVersion}, OS={OsVersion.Value}, VM={vmName}");
            }
            else if (RuntimeInformation.IsRunningInContainer)
            {
                yield return($"{BenchmarkDotNetCaption}=v{BenchmarkDotNetVersion}, OS={OsVersion.Value} (container)");
            }
            else
            {
                yield return($"{BenchmarkDotNetCaption}=v{BenchmarkDotNetVersion}, OS={OsVersion.Value}");
            }

            yield return(CpuInfoFormatter.Format(CpuInfo.Value));

            var cultureInfo = DefaultCultureInfo.Instance;

            if (HardwareTimerKind != HardwareTimerKind.Unknown)
            {
                yield return($"Frequency={ChronometerFrequency}, Resolution={ChronometerResolution.ToString(cultureInfo)}, Timer={HardwareTimerKind.ToString().ToUpper()}");
            }

            if (RuntimeInformation.IsNetCore && IsDotNetCliInstalled())
            {
                yield return($".NET Core SDK={DotNetSdkVersion.Value}");
            }
        }
        public override IEnumerable <string> ToFormattedString()
        {
            string vmName = VirtualMachineHypervisor.Value?.Name;

            if (vmName == null)
            {
                yield return($"{BenchmarkDotNetCaption}=v{BenchmarkDotNetVersion}, OS={OsVersion.Value}");
            }
            else
            {
                yield return($"{BenchmarkDotNetCaption}=v{BenchmarkDotNetVersion}, OS={OsVersion.Value}, VM={vmName}");
            }

            yield return(CpuInfoFormatter.Format(CpuInfo.Value));

            if (HardwareTimerKind != HardwareTimerKind.Unknown)
            {
                yield return($"Frequency={ChronometerFrequency}, Resolution={ChronometerResolution}, Timer={HardwareTimerKind.ToString().ToUpper()}");
            }
#if !CLASSIC
            if (IsDotNetCliInstalled())
            {
                yield return($".NET Core SDK={DotNetSdkVersion.Value}");
            }
#endif
        }
        public override IEnumerable <string> ToFormattedString()
        {
            yield return($"{BenchmarkDotNetCaption}=v{BenchmarkDotNetVersion}, OS={OsVersion.Value}");

            yield return($"Processor={ProcessorName.Value}, ProcessorCount={ProcessorCount}");

            if (HardwareTimerKind != HardwareTimerKind.Unknown)
            {
                yield return($"Frequency={ChronometerFrequency}, Resolution={ChronometerResolution}, Timer={HardwareTimerKind.ToString().ToUpper()}");
            }
#if !CLASSIC
            yield return($".NET Core SDK={DotNetSdkVersion.Value}");
#endif
        }
        public override IEnumerable <string> ToFormattedString()
        {
            string vmName = VirtualMachineHypervisor.Value?.Name;

            if (!string.IsNullOrEmpty(vmName))
            {
                yield return($"{BenchmarkDotNetCaption}=v{BenchmarkDotNetVersion}, OS={OsVersion.Value}, VM={vmName}");
            }
            else if (RuntimeInformation.IsRunningInContainer)
            {
                yield return($"{BenchmarkDotNetCaption}=v{BenchmarkDotNetVersion}, OS={OsVersion.Value} (container)");
            }
            else
            {
                yield return($"{BenchmarkDotNetCaption}=v{BenchmarkDotNetVersion}, OS={OsVersion.Value}");
            }

            yield return(CpuInfoFormatter.Format(CpuInfo.Value));

            var cultureInfo = DefaultCultureInfo.Instance;

            if (HardwareTimerKind != HardwareTimerKind.Unknown)
            {
                yield return($"Frequency={ChronometerFrequency}, Resolution={ChronometerResolution.ToString(cultureInfo)}, Timer={HardwareTimerKind.ToString().ToUpper()}");
            }

            if (RuntimeInformation.IsNetCore && IsDotNetCliInstalled())
            {
                // this wonderfull version number contains words like "preview" and ... 5 segments so it can not be parsed by Version.Parse. Example: "5.0.100-preview.8.20362.3"
                if (int.TryParse(new string(DotNetSdkVersion.Value.TrimStart().TakeWhile(char.IsDigit).ToArray()), out int major) && major >= 5)
                {
                    yield return($".NET SDK={DotNetSdkVersion.Value}");
                }
                else
                {
                    yield return($".NET Core SDK={DotNetSdkVersion.Value}");
                }
            }
        }