Skip to content

Commit

Permalink
Task remove trailing whitespace (#1259)
Browse files Browse the repository at this point in the history
* Remove all trailing whitespaces
  • Loading branch information
WojciechNagorski authored and adamsitnik committed Oct 1, 2019
1 parent cd88ed3 commit 2ba3033
Show file tree
Hide file tree
Showing 286 changed files with 996 additions and 996 deletions.
4 changes: 2 additions & 2 deletions samples/BenchmarkDotNet.Samples/IntroCategories.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ public class IntroCategories
[Benchmark]
[BenchmarkCategory("A", "1")]
public void A1() => Thread.Sleep(10); // Will be benchmarked

[Benchmark]
[BenchmarkCategory("A", "2")]
public void A2() => Thread.Sleep(10); // Will be benchmarked

[Benchmark]
[BenchmarkCategory("B", "1")]
public void B1() => Thread.Sleep(10); // Will be benchmarked

[Benchmark]
[BenchmarkCategory("B", "2")]
public void B2() => Thread.Sleep(10);
Expand Down
8 changes: 4 additions & 4 deletions samples/BenchmarkDotNet.Samples/IntroDeferredExecution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ namespace BenchmarkDotNet.Samples
{
public class IntroDeferredExecution
{
private readonly int[] numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
private readonly int[] numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

private readonly Consumer consumer = new Consumer();

/// <summary>
/// this benchmark returns a deferred LINQ query which is NOT executed
/// so the benchmark measures the cost of creating the query, not the actual execution
Expand All @@ -20,7 +20,7 @@ public class IntroDeferredExecution
/// <returns>deferred LINQ query</returns>
[Benchmark]
public IEnumerable<int> Wrong() => from number in numbers orderby number descending select number;

/// <summary>
/// this benchmark uses .Consume extension method which executes given deferred query and consumes its result
/// so the benchmark measures the cost of creating the query and executing it
Expand Down
2 changes: 1 addition & 1 deletion samples/BenchmarkDotNet.Samples/IntroDisassemblyAllJits.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public MultipleJits()
Add(DisassemblyDiagnoser.Create(new DisassemblyDiagnoserConfig(printAsm: true, printPrologAndEpilog: true, recursiveDepth: 3, printDiff: true)));
}
}

private Increment increment = new Increment();

[Benchmark]
Expand Down
2 changes: 1 addition & 1 deletion samples/BenchmarkDotNet.Samples/IntroDisassemblyDry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public JustDisassembly()
[Benchmark]
public void Foo()
{

}
}
}
6 changes: 3 additions & 3 deletions samples/BenchmarkDotNet.Samples/IntroEncoding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace BenchmarkDotNet.Samples
{
// *** Attribute Style ***

[EncodingAttribute.Unicode]
public class IntroEncoding
{
Expand All @@ -20,7 +20,7 @@ public long Foo()
return waitUntil;
}
}

// *** Object Style ***

[Config(typeof(Config))]
Expand All @@ -40,7 +40,7 @@ public long Foo()
return waitUntil;
}
}

// *** Fluent Config ***

public class IntroEncodingFluentConfig
Expand Down
2 changes: 1 addition & 1 deletion samples/BenchmarkDotNet.Samples/IntroEnvVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class IntroEnvVars
private class ConfigWithCustomEnvVars : ManualConfig
{
private const string JitNoInline = "COMPlus_JitNoInline";

public ConfigWithCustomEnvVars()
{
Add(Job.Default.With(CoreRuntime.Core21).WithId("Inlining enabled"));
Expand Down
8 changes: 4 additions & 4 deletions samples/BenchmarkDotNet.Samples/IntroExportJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace BenchmarkDotNet.Samples
{
// *** Attribute style ***

[DryJob]
[JsonExporterAttribute.Brief]
[JsonExporterAttribute.Full]
Expand All @@ -18,9 +18,9 @@ public class IntroExportJson
[Benchmark] public void Sleep10() => Thread.Sleep(10);
[Benchmark] public void Sleep20() => Thread.Sleep(20);
}

// *** Object style ***

[Config(typeof(Config))]
public class IntroJsonExportObjectStyle
{
Expand All @@ -35,7 +35,7 @@ public Config()
Add(JsonExporter.Custom("-custom", indentJson: true, excludeMeasurements: true));
}
}

[Benchmark] public void Sleep10() => Thread.Sleep(10);
[Benchmark] public void Sleep20() => Thread.Sleep(20);
}
Expand Down
4 changes: 2 additions & 2 deletions samples/BenchmarkDotNet.Samples/IntroFilters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ public Config()
new NameFilter(name => name.Contains("A")),
new NameFilter(name => name.Contains("1"))
));

// benchmark with names with length < 3
Add(new NameFilter(name => name.Length < 3));
}
}

[Benchmark] public void A1() => Thread.Sleep(10); // Will be benchmarked
[Benchmark] public void A2() => Thread.Sleep(10); // Will be benchmarked
[Benchmark] public void A3() => Thread.Sleep(10); // Will be benchmarked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Algo_Md5VsSha256()
[Benchmark]
public byte[] Sha256() => sha256.ComputeHash(data);
}

public class IntroFluentConfigBuilder
{
public static void Run()
Expand Down
2 changes: 1 addition & 1 deletion samples/BenchmarkDotNet.Samples/IntroHardwareCounters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace BenchmarkDotNet.Samples
{
[HardwareCounters(
HardwareCounter.BranchMispredictions,
HardwareCounter.BranchMispredictions,
HardwareCounter.BranchInstructions)]
public class IntroHardwareCounters
{
Expand Down
2 changes: 1 addition & 1 deletion samples/BenchmarkDotNet.Samples/IntroJobBaseline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace BenchmarkDotNet.Samples
public class IntroJobBaseline
{
[Benchmark]
public int SplitJoin()
public int SplitJoin()
=> string.Join(",", new string[1000]).Split(',').Length;
}
}
6 changes: 3 additions & 3 deletions samples/BenchmarkDotNet.Samples/IntroJoin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
namespace BenchmarkDotNet.Samples
{
// Run BenchmarkSwitcher with arguments: "--join --category=IntroJoinA"

[DryJob]
public class IntroJoin1
{
[Benchmark]
[BenchmarkCategory("IntroJoinA")]
public void A() => Thread.Sleep(10);

[Benchmark]
[BenchmarkCategory("IntroJoinB")]
public void B() => Thread.Sleep(10);
Expand All @@ -23,7 +23,7 @@ public class IntroJoin2
[Benchmark]
[BenchmarkCategory("IntroJoinA")]
public void A() => Thread.Sleep(10);

[Benchmark]
[BenchmarkCategory("IntroJoinB")]
public void B() => Thread.Sleep(10);
Expand Down
2 changes: 1 addition & 1 deletion samples/BenchmarkDotNet.Samples/IntroMultimodal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class IntroMultimodal
{
private readonly Random rnd = new Random(42);

private void Multimodal(int n)
private void Multimodal(int n)
=> Thread.Sleep((rnd.Next(n) + 1) * 100);

[Benchmark] public void Unimodal() => Multimodal(1);
Expand Down
2 changes: 1 addition & 1 deletion samples/BenchmarkDotNet.Samples/IntroNuGet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace BenchmarkDotNet.Samples
public class IntroNuGet
{
// Specify jobs with different versions of the same NuGet package to benchmark.
// The NuGet versions referenced on these jobs must be greater or equal to the
// The NuGet versions referenced on these jobs must be greater or equal to the
// same NuGet version referenced in this benchmark project.
// Example: This benchmark project references Newtonsoft.Json 9.0.1
private class Config : ManualConfig
Expand Down
2 changes: 1 addition & 1 deletion samples/BenchmarkDotNet.Samples/IntroOrderManual.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ orderby summary[benchmark].ResultStatistics.Mean
public string GetLogicalGroupKey(ImmutableArray<BenchmarkCase> allBenchmarksCases, BenchmarkCase benchmarkCase) =>
benchmarkCase.Job.DisplayInfo + "_" + benchmarkCase.Parameters.DisplayInfo;

public IEnumerable<IGrouping<string, BenchmarkCase>> GetLogicalGroupOrder(IEnumerable<IGrouping<string, BenchmarkCase>> logicalGroups) =>
public IEnumerable<IGrouping<string, BenchmarkCase>> GetLogicalGroupOrder(IEnumerable<IGrouping<string, BenchmarkCase>> logicalGroups) =>
logicalGroups.OrderBy(it => it.Key);

public bool SeparateLogicalGroups => true;
Expand Down
4 changes: 2 additions & 2 deletions samples/BenchmarkDotNet.Samples/IntroSetupCleanupGlobal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void GlobalSetup()
{
data = new int[N]; // executed once per each N value
}

[Benchmark]
public int Logic()
{
Expand All @@ -23,7 +23,7 @@ public int Logic()
res += data[i];
return res;
}

[GlobalCleanup]
public void GlobalCleanup()
{
Expand Down
12 changes: 6 additions & 6 deletions samples/BenchmarkDotNet.Samples/IntroSetupCleanupTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@

namespace BenchmarkDotNet.Samples
{
[SimpleJob(RunStrategy.Monitoring, launchCount: 0,
[SimpleJob(RunStrategy.Monitoring, launchCount: 0,
warmupCount: 0, targetCount: 1)]
public class IntroSetupCleanupTarget
{
[GlobalSetup(Target = nameof(BenchmarkA))]
public void GlobalSetupA()
public void GlobalSetupA()
=> Console.WriteLine("// " + "GlobalSetup A");

[Benchmark]
public void BenchmarkA()
public void BenchmarkA()
=> Console.WriteLine("// " + "Benchmark A");

[GlobalSetup(Targets = new[] { nameof(BenchmarkB), nameof(BenchmarkC) })]
public void GlobalSetupB()
=> Console.WriteLine("// " + "GlobalSetup B");

[Benchmark]
public void BenchmarkB()
public void BenchmarkB()
=> Console.WriteLine("// " + "Benchmark B");

[Benchmark]
public void BenchmarkC()
public void BenchmarkC()
=> Console.WriteLine("// " + "Benchmark C");

[Benchmark]
public void BenchmarkD()
public void BenchmarkD()
=> Console.WriteLine("// " + "Benchmark D");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace BenchmarkDotNet.Attributes
/// <remarks>It's going to be executed only once, after all benchmark runs.</remarks>
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
[MeansImplicitUse]
[MeansImplicitUse]
public class GlobalCleanupAttribute : TargetedAttribute
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ParamsAttribute : Attribute
// CLS-Compliant Code requires a constructor without an array in the argument list
public ParamsAttribute() => Values = new object[0];

public ParamsAttribute(params object[] values)
public ParamsAttribute(params object[] values)
=> Values = values ?? new object[] { null }; // when users do Params(null) they mean one, null argument
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void DisplayResults(ILogger logger)
{
if (!benchmarkToCvTraceFile.Any())
return;

logger.WriteLineInfo($"Exported {benchmarkToCvTraceFile.Count} CV trace file(s). Example:");
logger.WriteLineInfo(benchmarkToCvTraceFile.Values.First());
logger.WriteLineInfo("DO remember that this Diagnoser just tries to mimic the CVCollectionCmd.exe and you need to have Visual Studio with Concurrency Visualizer plugin installed to visualize the data.");
Expand All @@ -80,7 +80,7 @@ public void Handle(HostSignal signal, DiagnoserActionParameters parameters)
private static EtwProfilerConfig CreateDefaultConfig()
{
var kernelKeywords = KernelTraceEventParser.Keywords.ImageLoad | KernelTraceEventParser.Keywords.Profile; // same as for EtwProfiler

// following keywords come from decompiled "GetLocalTraceProviders" of CVCollectionService.exe
// we don't use KernelTraceEventParser.Keywords.Dispatcher because it blows the CV Visualizer in VS, same goes for KernelTraceEventParser.Keywords.ThreadTime which I tried to experiment with
kernelKeywords |= KernelTraceEventParser.Keywords.Process | KernelTraceEventParser.Keywords.Thread | KernelTraceEventParser.Keywords.ContextSwitch;
Expand Down Expand Up @@ -111,7 +111,7 @@ private static EtwProfilerConfig CreateDefaultConfig()
| ClrTraceEventParser.Keywords.ThreadTransfer), // extra
new TraceEventProviderOptions { StacksEnabled = false }) // stacks are too expensive for our purposes
};

return new EtwProfilerConfig(
performExtraBenchmarksRun: false,
kernelKeywords: kernelKeywords,
Expand All @@ -126,8 +126,8 @@ private string CreateCvTraceFile(DiagnoserActionParameters parameters)
var directoryPath = Path.GetDirectoryName(traceFilePath);
var cvPathFile = Path.ChangeExtension(traceFilePath, ".CvTrace");
var traceFileName = Path.GetFileName(traceFilePath);
File.WriteAllText(cvPathFile,

File.WriteAllText(cvPathFile,
$@"<?xml version=""1.0""?>
<ConcurrencyTrace xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" MajorVersion=""1"" MinorVersion=""0"">
<Config MajorVersion=""1"" MinorVersion=""0"">
Expand Down
4 changes: 2 additions & 2 deletions src/BenchmarkDotNet.Diagnostics.Windows/EtwDiagnoser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected void Start(DiagnoserActionParameters parameters)
// This is in effect the inverted sequence of actions in the Stop() method.
Console.CancelKeyPress += OnConsoleCancelKeyPress;
AppDomain.CurrentDomain.ProcessExit += OnProcessExit;

Session = CreateSession(parameters.BenchmarkCase);

EnableProvider();
Expand All @@ -56,7 +56,7 @@ protected void Start(DiagnoserActionParameters parameters)
// and through the TraceEventSession class, which is thread-safe.
var task = Task.Factory.StartNew((Action)(() => Session.Source.Process()), TaskCreationOptions.LongRunning);

// wait until the processing has started, block by then so we don't loose any
// wait until the processing has started, block by then so we don't loose any
// information (very important for jit-related things)
WaitUntilStarted(task);
}
Expand Down
4 changes: 2 additions & 2 deletions src/BenchmarkDotNet.Diagnostics.Windows/HardwareCounters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ private static readonly Dictionary<HardwareCounter, string> EtwTranslations
{ HardwareCounter.BranchInstructionRetired, "BranchInstructionRetired" },
{ HardwareCounter.BranchMispredictsRetired, "BranchMispredictsRetired" }
};

public static IEnumerable<ValidationError> Validate(ValidationParameters validationParameters, bool mandatory)
{
if (!RuntimeInformation.IsWindows())
{
yield return new ValidationError(true, "Hardware Counters and EtwProfiler are supported only on Windows");
yield break;
}

if (!validationParameters.Config.GetHardwareCounters().Any() && mandatory)
{
yield return new ValidationError(true, "No Hardware Counters defined, probably a bug");
Expand Down
8 changes: 4 additions & 4 deletions src/BenchmarkDotNet.Diagnostics.Windows/InliningDiagnoser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected override void AttachToEvents(TraceEventSession session, BenchmarkCase
session.Source.Clr.MethodInliningSucceeded += jitData =>
{
// Inliner = the parent method (the inliner calls the inlinee)
// Inlinee = the method that is going to be "inlined" inside the inliner (it's caller)
// Inlinee = the method that is going to be "inlined" inside the inliner (it's caller)
if (StatsPerProcess.TryGetValue(jitData.ProcessID, out _))
{
var shouldPrint = !logFailuresOnly
Expand Down Expand Up @@ -96,10 +96,10 @@ protected override void AttachToEvents(TraceEventSession session, BenchmarkCase
}
};
}

private bool ShouldPrintEventInfo(string inlinerNamespace, string inlineeNamespace)
=> !filterByNamespace ||
(allowedNamespaces?.Any(x=> inlineeNamespace.StartsWith(x) || inlinerNamespace.StartsWith(x))
=> !filterByNamespace ||
(allowedNamespaces?.Any(x=> inlineeNamespace.StartsWith(x) || inlinerNamespace.StartsWith(x))
?? (inlinerNamespace.StartsWith(defaultNamespace)) || inlineeNamespace.StartsWith(defaultNamespace));
}
}
Loading

0 comments on commit 2ba3033

Please sign in to comment.