Skip to content

Commit

Permalink
Fix bugs and typos (#2168)
Browse files Browse the repository at this point in the history
* Fix bugs

* Fix typos in comments
  • Loading branch information
YegorStepanov authored Oct 25, 2022
1 parent 1fb1015 commit c02c3d8
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ bool IsCallStackIn(StackSourceCallStackIndex index)
return;
}

// Heap is dieing, kill all objects in it.
// Heap is dying, kill all objects in it.
var allocs = lastHeapAllocs;
if (data.HeapHandle != lastHeapHandle)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public IEnumerable<Metric> CalculateMetrics(Dictionary<int, int> profileSourceId

private IterationData[] CreateIterationData(List<double> startStopTimeStamps)
{
// collection contains mixted .Start and .Stop intervals, if we sort it we know that n is Start and n + 1 is Stop
// collection contains mixed .Start and .Stop intervals, if we sort it we know that n is Start and n + 1 is Stop
startStopTimeStamps.Sort();

var iterations = new IterationData[startStopTimeStamps.Count / 2];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class OperatingSystemsFilterAttribute : FilterConfigBaseAttribute
// CLS-Compliant Code requires a constructor without an array in the argument list
public OperatingSystemsFilterAttribute() { }

/// <param name="allowed">if set to true, the OSes beloning to platforms are enabled, if set to false, disabled</param>
/// <param name="allowed">if set to true, the OSes belonging to platforms are enabled, if set to false, disabled</param>
/// <param name="platforms">the platform(s) for which the filter should be applied</param>
public OperatingSystemsFilterAttribute(bool allowed, params OS[] platforms)
: base(new SimpleFilter(_ =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ internal static IReadOnlyList<Element> Prettify(DisassembledMethod method, Disas
referencedAddresses.Add(asm.ReferencedAddress.Value);
}

// for every IP that is referenced, we emit a uinque label
// for every IP that is referenced, we emit a unique label
var addressesToLabels = new Dictionary<ulong, string>();
int currentLabelIndex = 0;
foreach (var instruction in asmInstructions)
Expand Down
2 changes: 1 addition & 1 deletion src/BenchmarkDotNet/Environments/HostEnvironmentInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public override IEnumerable<string> ToFormattedString()

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"
// this wonderful 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
Expand Down
2 changes: 1 addition & 1 deletion src/BenchmarkDotNet/Jobs/EnvironmentVariable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class EnvironmentVariable : IEquatable<EnvironmentVariable>
public EnvironmentVariable([NotNull] string key, [NotNull] string value)
{
Key = key ?? throw new ArgumentNullException(nameof(key));
Value = value ?? throw new ArgumentNullException(nameof(Value));
Value = value ?? throw new ArgumentNullException(nameof(value));
}

[NotNull]
Expand Down
2 changes: 1 addition & 1 deletion src/BenchmarkDotNet/Jobs/NugetReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public NuGetReference(string packageName, string packageVersion, Uri source = nu

PackageName = packageName;

if (!string.IsNullOrWhiteSpace(PackageVersion) && !IsValidVersion(packageVersion))
if (!string.IsNullOrWhiteSpace(packageVersion) && !IsValidVersion(packageVersion))
throw new InvalidOperationException($"Invalid version specified: {packageVersion}");

PackageVersion = packageVersion ?? string.Empty;
Expand Down
2 changes: 1 addition & 1 deletion src/BenchmarkDotNet/Reports/BenchmarkReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public BenchmarkReport(
BuildResult = buildResult;
ExecuteResults = executeResults ?? Array.Empty<ExecuteResult>();
AllMeasurements = ExecuteResults.SelectMany((results, index) => results.Measurements).ToArray();
GcStats = ExecuteResults.Count > 0 ? executeResults[executeResults.Count -1].GcStats : default;
GcStats = ExecuteResults.Count > 0 ? ExecuteResults[ExecuteResults.Count - 1].GcStats : default;
Metrics = metrics?.ToDictionary(metric => metric.Descriptor.Id)
?? (IReadOnlyDictionary<string, Metric>)ImmutableDictionary<string, Metric>.Empty;
}
Expand Down
8 changes: 4 additions & 4 deletions src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ internal static Summary[] Run(BenchmarkRunInfo[] benchmarkRunInfos)

compositeLogger.WriteLineInfo("// Validating benchmarks:");

var (supportedBenchmarks, validationErrors) = GetSupportedBenchmarks(benchmarkRunInfos, compositeLogger, resolver);
var (supportedBenchmarks, validationErrors) = GetSupportedBenchmarks(benchmarkRunInfos, resolver);

validationErrors.AddRange(Validate(supportedBenchmarks));

Expand Down Expand Up @@ -532,11 +532,11 @@ private static ExecuteResult RunExecute(ILogger logger, BenchmarkCase benchmarkC
private static void LogTotalTime(ILogger logger, TimeSpan time, int executedBenchmarksCount, string message = "Total time")
=> logger.WriteLineStatistic($"{message}: {time.ToFormattedTotalTime(DefaultCultureInfo.Instance)}, executed benchmarks: {executedBenchmarksCount}");

private static (BenchmarkRunInfo[], List<ValidationError>) GetSupportedBenchmarks(BenchmarkRunInfo[] benchmarkRunInfos, ILogger logger, IResolver resolver)
private static (BenchmarkRunInfo[], List<ValidationError>) GetSupportedBenchmarks(BenchmarkRunInfo[] benchmarkRunInfos, IResolver resolver)
{
List<ValidationError> validationErrors = new ();

var benchmarksRunInfo = benchmarkRunInfos.Select(info => new BenchmarkRunInfo(
var runInfos = benchmarkRunInfos.Select(info => new BenchmarkRunInfo(
info.BenchmarksCases.Where(benchmark =>
{
var errors = benchmark.GetToolchain().Validate(benchmark, resolver).ToArray();
Expand All @@ -548,7 +548,7 @@ private static (BenchmarkRunInfo[], List<ValidationError>) GetSupportedBenchmark
.Where(infos => infos.BenchmarksCases.Any())
.ToArray();

return (benchmarkRunInfos, validationErrors);
return (runInfos, validationErrors);
}

private static string GetRootArtifactsFolderPath(BenchmarkRunInfo[] benchmarkRunInfos)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public void MethodDeclarationOrderIsPreserved()

public class BAC
{
// BAC is not sorted in either desceding or ascending way
// BAC is not sorted in either descending or ascending way
[Benchmark] public void B() { }
[Benchmark] public void A() { }
[Benchmark] public void C() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ public void CustomTargetPlatformJobsAreGroupedByTargetFrameworkMoniker()

Assert.Equal(2, grouped.Length);

Assert.Single(grouped, group => group.Count() == 3); // Plain1 (3 methods) runing against "net5.0"
Assert.Single(grouped, group => group.Count() == 6); // Plain2 (3 methods) and Plain3 (3 methods) runing against "net5.0-windows"
Assert.Single(grouped, group => group.Count() == 3); // Plain1 (3 methods) running against "net5.0"
Assert.Single(grouped, group => group.Count() == 6); // Plain2 (3 methods) and Plain3 (3 methods) running against "net5.0-windows"
}
}
}

0 comments on commit c02c3d8

Please sign in to comment.