[Tizen] Add BuildTools 2.1.0-rc1-02804-05
[platform/upstream/coreclr.git] / packages / microsoft.dotnet.buildtools / 2.1.0-rc1-02804-05 / lib / PerfTesting.targets
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 -->
4   <PropertyGroup>
5     <TraceEventPackage>Microsoft.Diagnostics.Tracing.TraceEvent\$(TraceEventPackageVersion)</TraceEventPackage>
6   </PropertyGroup>
7   
8   <ItemGroup>
9     <TraceEventNativePath Include="$(PackagesDir)\$(TraceEventPackage)\lib\native\**\*.*" />
10   </ItemGroup>
11   
12   <Target Name ="PublishPerfRunner" Condition="'$(Performance)'=='true'" BeforeTargets="RunTestsForProject">
13     <Copy SourceFiles="@(TraceEventNativePath)" DestinationFiles="@(TraceEventNativePath->'$(StartWorkingDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
14   </Target>
15
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>
20   </PropertyGroup>
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>
25   </PropertyGroup>
26   <ItemGroup>
27     <PerfTestCommandLines Include="$(PerfTestCommand)" />
28   </ItemGroup>
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=")" />
33   </ItemGroup>
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" />
39   </ItemGroup>
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]" />
44   </ItemGroup>
45
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 &quot;CoreFx&quot; --type &quot;$(BenchviewRuntype)&quot; --config-name &quot;$(ConfigurationGroup)&quot; --config Configuration &quot;$(ConfigurationGroup)&quot; --config OS &quot;$(TargetOS)&quot; -arch &quot;$(Platform)&quot; --machinepool &quot;PerfSnake&quot;"/>
49       <BenchviewCalls Include = "py $(BenchviewDir)\upload.py submission.json --container corefx"/>
50     </ItemGroup>
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 &quot;CoreFx&quot; --type &quot;$(BenchviewRuntype)&quot; --config-name &quot;$(ConfigurationGroup)&quot; --config Configuration &quot;$(ConfigurationGroup)&quot; --config OS &quot;$(TargetOS)&quot; -arch &quot;$(Platform)&quot; --machinepool &quot;PerfSnake&quot;"/>
53       <BenchviewCalls Include = "python3.5 $(BenchviewDir)/upload.py submission.json --container corefx"/>
54     </ItemGroup>
55     <Exec Command="%(BenchviewCalls.Identity)"/>
56     </Target>
57   
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." />
62   </Target>
63 </Project>