Пример #1
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}");
            }
        }
Пример #2
0
        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
        }
Пример #3
0
        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()
        {
            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}");
                }
            }
        }