Skip to content

Commit

Permalink
feat: Add benchmark filter
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Mar 30, 2020
1 parent 762c64e commit 1335d7b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
<UserControl
x:Class="Benchmarks.Shared.Controls.BenchmarkDotNetControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Benchmarks.Shared.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<UserControl x:Class="Benchmarks.Shared.Controls.BenchmarkDotNetControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Benchmarks.Shared.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">

<Grid>
<Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<TextBox PlaceholderText="Class name contains..."
Width="400"
Text="{x:Bind ClassFilter, Mode=TwoWay}"
HorizontalAlignment="Left" />
<Button x:Name="runButton"
Content="Run Benchmarks"
Click="OnRunTests" />
Content="Run Benchmarks"
Click="OnRunTests" />
<TextBlock x:Name="runStatus"
Text="Not initialized" />
Text="Not initialized" />
</StackPanel>
<ScrollViewer Grid.Row="1" Background="Black" Padding="12">
<TextBlock x:Name="runLogs" FontFamily="Courier New" FontSize="12" IsTextSelectionEnabled="True" />
<ScrollViewer Grid.Row="1"
Background="Black"
Padding="12">
<TextBlock x:Name="runLogs"
FontFamily="Courier New"
FontSize="12"
IsTextSelectionEnabled="True" />
</ScrollViewer>
</Grid>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public BenchmarkDotNetControl()
this.InitializeComponent();
}

public string ClassFilter { get; set; } = "";

private void OnRunTests(object sender, object args)
{
_ = Dispatcher.RunAsync(
Expand Down Expand Up @@ -81,6 +83,7 @@ private IEnumerable<Type> EnumerateBenchmarks(IConfig config)
where !type.IsGenericType
where type.Namespace?.StartsWith(BenchmarksBaseNamespace) ?? false
where BenchmarkConverter.TypeToBenchmarks(type, config).BenchmarksCases.Length != 0
where string.IsNullOrEmpty(ClassFilter) || type.Name.Contains(ClassFilter)
select type;

public class CoreConfig : ManualConfig
Expand Down

0 comments on commit 1335d7b

Please sign in to comment.