Skip to content

Commit

Permalink
Merge pull request #13 from Aaronontheweb/nbench-integraiton
Browse files Browse the repository at this point in the history
added NBench benchmarks
  • Loading branch information
Aaronontheweb committed Dec 8, 2015
2 parents f74dbc9 + aa3dd3a commit 7679099
Show file tree
Hide file tree
Showing 13 changed files with 182 additions and 135 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ bld/
# Roslyn cache directories
*.ide/

# FAKE
.fake/
[Pp]erf[Rr]esult*/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
Expand Down
4 changes: 3 additions & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ pushd %~dp0

tools\nuget\NuGet.exe update -self

tools\nuget\NuGet.exe install FAKE -OutputDirectory src\packages -ExcludeVersion -Version 3.4.1
tools\nuget\NuGet.exe install FAKE -OutputDirectory src\packages -ExcludeVersion

if not exist src\packages\SourceLink.Fake\tools\SourceLink.fsx (
tools\nuget\nuget.exe install SourceLink.Fake -OutputDirectory src\packages -ExcludeVersion
)
rem cls

tools\nuget\NuGet.exe install NBench.Runner -OutputDirectory src\packages -ExcludeVersion

set encoding=utf-8
src\packages\FAKE\tools\FAKE.exe build.fsx %*

Expand Down
64 changes: 50 additions & 14 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

open System
open System.IO
open System.Text
open Fake
open Fake.FileUtils
open Fake.TaskRunnerHelper
Expand All @@ -29,12 +30,22 @@ let release =
// Directories

let binDir = "bin"
let testOutput = "TestResults"
let testOutput = FullName "TestResults"
let perfOutput = FullName "PerfResults"

let nugetDir = binDir @@ "nuget"
let workingDir = binDir @@ "build"
let nugetExe = FullName @"tools\nuget\NuGet.exe"

open Fake.RestorePackageHelper
Target "RestorePackages" (fun _ ->
"./src/Helios.DedicatedThreadPool.sln"
|> RestoreMSSolutionPackages (fun p ->
{ p with
OutputPath = "./src/packages"
Retries = 4 })
)

//--------------------------------------------------------------------------------
// Clean build results

Expand Down Expand Up @@ -78,17 +89,6 @@ Target "RunTests" <| fun _ ->
{p with
DisableShadowCopy = true;
OutputFile = testOutput @@ "TestResults.xml" })

//--------------------------------------------------------------------------------
// Benchmark targets
//--------------------------------------------------------------------------------
Target "Benchmarks" <| fun _ ->
let benchmarkPath = findToolInSubPath "Helios.DedicatedThreadPool.VsThreadpoolBenchmark.exe" "bin/benchmark/**/bin/Release/*"

let result = ExecProcess(fun info ->
info.FileName <- benchmarkPath) (System.TimeSpan.FromMinutes 10.0) (* This is a long-running task *)
if result <> 0 then failwithf "Benchmark failed. %s" benchmarkPath



//--------------------------------------------------------------------------------
Expand All @@ -97,6 +97,41 @@ Target "Benchmarks" <| fun _ ->
Target "CleanTests" <| fun _ ->
DeleteDir testOutput

//--------------------------------------------------------------------------------
// NBench targets
//--------------------------------------------------------------------------------
Target "NBench" <| fun _ ->
let testSearchPath =
let assemblyFilter = getBuildParamOrDefault "spec-assembly" String.Empty
sprintf "src/tests/**/bin/Release/*%s*.Tests.Performance.dll" assemblyFilter

mkdir perfOutput
let nbenchTestPath = findToolInSubPath "NBench.Runner.exe" "src/packges/NBench.Runner*"
let nbenchTestAssemblies = !! testSearchPath
printfn "Using NBench.Runner: %s" nbenchTestPath

let runNBench assembly =
let spec = getBuildParam "spec"

let args = new StringBuilder()
|> append assembly
|> append (sprintf "output-directory=\"%s\"" perfOutput)
|> toText

let result = ExecProcess(fun info ->
info.FileName <- nbenchTestPath
info.WorkingDirectory <- (Path.GetDirectoryName (FullName nbenchTestPath))
info.Arguments <- args) (System.TimeSpan.FromMinutes 15.0) (* Reasonably long-running task. *)
if result <> 0 then failwithf "NBench.Runner failed. %s %s" nbenchTestPath args

nbenchTestAssemblies |> Seq.iter (runNBench)

//--------------------------------------------------------------------------------
// Clean NBench output
Target "CleanPerf" <| fun _ ->
DeleteDir perfOutput


//--------------------------------------------------------------------------------
// Nuget targets
//--------------------------------------------------------------------------------
Expand Down Expand Up @@ -288,7 +323,7 @@ Target "HelpNuget" <| fun _ ->
Target "All" DoNothing

// build dependencies
"Clean" ==> "Build" ==> "CopyOutput" ==> "BuildRelease"
"Clean" ==> "RestorePackages" ==> "Build" ==> "CopyOutput" ==> "BuildRelease"

// tests dependencies
"CleanTests" ==> "RunTests"
Expand All @@ -297,7 +332,8 @@ Target "All" DoNothing

"BuildRelease" ==> "All"
"RunTests" ==> "All"
"Benchmarks" ==> "All"
"NBench" ==> "All"
"Nuget" ==> "All"


RunTargetOrDefault "Help"
5 changes: 4 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ popd > /dev/null

mono $SCRIPT_PATH/tools/nuget/NuGet.exe update -self

mono $SCRIPT_PATH/tools/nuget/NuGet.exe install FAKE -OutputDirectory $SCRIPT_PATH/src/packages -ExcludeVersion -Version 3.4.1
mono $SCRIPT_PATH/tools/nuget/NuGet.exe install FAKE -OutputDirectory $SCRIPT_PATH/src/packages -ExcludeVersion

mono $SCRIPT_PATH/tools/nuget/NuGet.exe install NBench.Runner -OutputDirectory $SCRIPT_PATH/src/packages -ExcludeVersion


if ! [ -e $SCRIPT_PATH/src/packages/SourceLink.Fake/tools/SourceLink.fsx ] ; then
mono $SCRIPT_PATH/tools/nuget/NuGet.exe install SourceLink.Fake -OutputDirectory $SCRIPT_PATH/src/packages -ExcludeVersion
Expand Down
26 changes: 12 additions & 14 deletions src/Helios.DedicatedThreadPool.sln
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Helios.DedicatedThreadPool", "core\Helios.DedicatedThreadPool\Helios.DedicatedThreadPool.csproj", "{6C8F359E-E479-44D5-8FA0-02BFD38C3860}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Helios.DedicatedThreadPool.Tests", "tests\Helios.DedicatedThreadPool.Tests\Helios.DedicatedThreadPool.Tests.csproj", "{BD7B3C66-14D8-4F01-AECE-F7F3F440A899}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Helios.DedicatedThreadPool.VsThreadpoolBenchmark", "benchmark\Helios.DedicatedThreadPool.VsThreadpoolBenchmark\Helios.DedicatedThreadPool.VsThreadpoolBenchmark.csproj", "{3636FEFB-5631-4D26-9923-9754267AF325}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{741F51D5-FB48-4AE3-837E-3C32FAC6584E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmark", "benchmark", "{E9ADEF95-5656-4CD6-B3EA-E9DE7F0DED85}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{E86B275F-E912-47C5-8F5E-BA62D5959EBD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{527902B6-8DD0-41E9-AB01-EE6A809F5447}"
Expand All @@ -27,7 +23,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{39EF5B
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Helios.DedicatedThreadPool.Tests.Performance", "tests\Helios.DedicatedThreadPool.Tests.Performance\Helios.DedicatedThreadPool.Tests.Performance.csproj", "{428DF580-1734-4AB6-B80E-F5ABABCE61D6}"
EndProject
Global
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Expand All @@ -41,20 +42,17 @@ Global
{BD7B3C66-14D8-4F01-AECE-F7F3F440A899}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD7B3C66-14D8-4F01-AECE-F7F3F440A899}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD7B3C66-14D8-4F01-AECE-F7F3F440A899}.Release|Any CPU.Build.0 = Release|Any CPU
{3636FEFB-5631-4D26-9923-9754267AF325}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3636FEFB-5631-4D26-9923-9754267AF325}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3636FEFB-5631-4D26-9923-9754267AF325}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3636FEFB-5631-4D26-9923-9754267AF325}.Release|Any CPU.Build.0 = Release|Any CPU
{428DF580-1734-4AB6-B80E-F5ABABCE61D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{428DF580-1734-4AB6-B80E-F5ABABCE61D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{428DF580-1734-4AB6-B80E-F5ABABCE61D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{428DF580-1734-4AB6-B80E-F5ABABCE61D6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{6C8F359E-E479-44D5-8FA0-02BFD38C3860} = {E86B275F-E912-47C5-8F5E-BA62D5959EBD}
{BD7B3C66-14D8-4F01-AECE-F7F3F440A899} = {741F51D5-FB48-4AE3-837E-3C32FAC6584E}
{3636FEFB-5631-4D26-9923-9754267AF325} = {E9ADEF95-5656-4CD6-B3EA-E9DE7F0DED85}
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
{428DF580-1734-4AB6-B80E-F5ABABCE61D6} = {741F51D5-FB48-4AE3-837E-3C32FAC6584E}
EndGlobalSection
EndGlobal

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: InternalsVisibleTo("Helios.DedicatedThreadPool.Tests")]
[assembly: InternalsVisibleTo("Helios.DedicatedThreadPool.Tests.Performance")]
[assembly: InternalsVisibleTo("Helios.DedicatedThreadPool.VsThreadpoolBenchmark")]
[assembly: InternalsVisibleTo("Helios.DedicatedThreadPool.VsDedicatedThreadFiber")]
Loading

0 comments on commit 7679099

Please sign in to comment.