1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <!-- Perf Analysis NuGet package paths -->
5 <TraceEventPackage>Microsoft.Diagnostics.Tracing.TraceEvent\$(TraceEventPackageVersion)</TraceEventPackage>
9 <TraceEventNativePath Include="$(PackagesDir)\$(TraceEventPackage)\lib\native\**\*.*" />
12 <Target Name ="PublishPerfRunner" Condition="'$(Performance)'=='true'" BeforeTargets="RunTestsForProject">
13 <Copy SourceFiles="@(TraceEventNativePath)" DestinationFiles="@(TraceEventNativePath->'$(StartWorkingDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
16 <PropertyGroup Condition="'$(TargetOS)'=='Linux'">
17 <PerfTestCommandDotnetExecutable>$RUNTIME_PATH/dotnet</PerfTestCommandDotnetExecutable>
18 <PerfTestCommand>$(PerfTestCommandDotnetExecutable) PerfRunner.exe --perf:runid Perf</PerfTestCommand>
19 <BenchviewDir>$(ToolsDir)Microsoft.BenchView.JSONFormat/tools</BenchviewDir>
21 <PropertyGroup Condition="'$(TargetOS)'=='Windows_NT'">
22 <PerfTestCommandDotnetExecutable>PerfRunner.exe</PerfTestCommandDotnetExecutable>
23 <PerfTestCommand>%RUNTIME_PATH%\dotnet.exe $(PerfTestCommandDotnetExecutable) --perf:runid Perf</PerfTestCommand>
24 <BenchviewDir>$(ToolsDir)Microsoft.BenchView.JSONFormat\tools</BenchviewDir>
27 <PerfTestCommandLines Include="$(PerfTestCommand)" />
29 <ItemGroup Condition="'$(TargetOS)'=='Windows_NT' and '$(LogToBenchview)' == 'true'">
30 <PerfTestCommandLines Include="if exist Perf-$(AssemblyName).xml (" />
31 <PerfTestCommandLines Include="py $(BenchviewDir)\measurement.py xunit Perf-$(AssemblyName).xml --better desc --drop-first-value --append -o $(ProjectDir)measurement.json" />
32 <PerfTestCommandLines Include=")" />
34 <ItemGroup Condition="'$(TargetOS)'=='Linux' and '$(LogToBenchview)' == 'true'">
35 <PerfTestCommandLines Include="if [ -a Perf-$(AssemblyName).xml ]" />
36 <PerfTestCommandLines Include="then" />
37 <PerfTestCommandLines Include="python3.5 $(BenchviewDir)\measurement.py xunit Perf-$(AssemblyName).xml --better desc --drop-first-value --append -o $(ProjectDir)measurement.json" />
38 <PerfTestCommandLines Include="fi" />
40 <!-- Optimizations to configure Xunit for performance -->
41 <ItemGroup Condition="'$(IncludePerformanceTests)' == 'true'">
42 <AssemblyInfoUsings Include="using Microsoft.Xunit.Performance%3B" />
43 <AssemblyInfoLines Include="[assembly:OptimizeForBenchmarks]" />
46 <Target Name="UploadToBenchview" Condition="'$(LogToBenchview)' == 'true'" AfterTargets="TestAllProjects">
47 <ItemGroup Condition="'$(TargetOS)'=='Windows_NT'">
48 <BenchviewCalls Include="py $(BenchviewDir)\submission.py $(ProjectDir)measurement.json --build $(ProjectDir)build.json --machine-data $(ProjectDir)machinedata.json --metadata $(ProjectDir)submission-metadata.json --group "CoreFx" --type "$(BenchviewRuntype)" --config-name "$(ConfigurationGroup)" --config Configuration "$(ConfigurationGroup)" --config OS "$(TargetOS)" -arch "$(Platform)" --machinepool "PerfSnake""/>
49 <BenchviewCalls Include = "py $(BenchviewDir)\upload.py submission.json --container corefx"/>
51 <ItemGroup Condition="'$(TargetOS)'=='Linux'">
52 <BenchviewCalls Include="python3.5 $(BenchviewDir)/submission.py $(ProjectDir)measurement.json --build $(ProjectDir)build.json --machine-data $(ProjectDir)machinedata.json --metadata $(ProjectDir)submission-metadata.json --group "CoreFx" --type "$(BenchviewRuntype)" --config-name "$(ConfigurationGroup)" --config Configuration "$(ConfigurationGroup)" --config OS "$(TargetOS)" -arch "$(Platform)" --machinepool "PerfSnake""/>
53 <BenchviewCalls Include = "python3.5 $(BenchviewDir)/upload.py submission.json --container corefx"/>
55 <Exec Command="%(BenchviewCalls.Identity)"/>
58 <Target Name="WarnForDebugPerfConfiguration"
59 BeforeTargets="RunTestsForProject"
60 Condition="'$(Performance)' == 'true' and !$(ConfigurationGroup.ToLower().Contains('release'))">
61 <Warning Text="You are running performance tests in a configuration other than Release. Your results may be unreliable." />