зеркало из https://github.com/microsoft/TestWinRT.git
Adding a component for benchmarks. (#27)
* Adding a component which is stable and can be used for benchmarks. * Rename properties to easily distinguish one on default interface. * Add comment to identify scenario.
This commit is contained in:
Родитель
427f66c2cd
Коммит
6d72afbcb5
|
@ -0,0 +1,64 @@
|
|||
#include "pch.h"
|
||||
#include "BenchmarkComponent.h"
|
||||
#include "ClassWithMultipleInterfaces.g.cpp"
|
||||
|
||||
namespace winrt::BenchmarkComponent::implementation
|
||||
{
|
||||
ClassWithMultipleInterfaces::ClassWithMultipleInterfaces()
|
||||
{
|
||||
}
|
||||
|
||||
int32_t ClassWithMultipleInterfaces::IntProperty()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ClassWithMultipleInterfaces::IntProperty(int32_t val)
|
||||
{
|
||||
}
|
||||
|
||||
bool ClassWithMultipleInterfaces::BoolProperty()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void ClassWithMultipleInterfaces::BoolProperty(bool val)
|
||||
{
|
||||
}
|
||||
|
||||
double ClassWithMultipleInterfaces::DoubleProperty()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ClassWithMultipleInterfaces::DoubleProperty(double val)
|
||||
{
|
||||
}
|
||||
|
||||
int32_t ClassWithMultipleInterfaces::DefaultIntProperty()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool ClassWithMultipleInterfaces::DefaultBoolProperty()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
double ClassWithMultipleInterfaces::DefaultDoubleProperty()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ClassWithMultipleInterfaces::DefaultIntProperty(int32_t val)
|
||||
{
|
||||
}
|
||||
|
||||
void ClassWithMultipleInterfaces::DefaultBoolProperty(bool val)
|
||||
{
|
||||
}
|
||||
|
||||
void ClassWithMultipleInterfaces::DefaultDoubleProperty(double val)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
EXPORTS
|
||||
DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
|
||||
DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
|
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
|
||||
#include "ClassWithMultipleInterfaces.g.h"
|
||||
|
||||
namespace winrt::BenchmarkComponent::implementation
|
||||
{
|
||||
struct ClassWithMultipleInterfaces : ClassWithMultipleInterfacesT<ClassWithMultipleInterfaces>
|
||||
{
|
||||
ClassWithMultipleInterfaces();
|
||||
|
||||
int32_t IntProperty();
|
||||
void IntProperty(int32_t val);
|
||||
|
||||
bool BoolProperty();
|
||||
void BoolProperty(bool val);
|
||||
|
||||
double DoubleProperty();
|
||||
void DoubleProperty(double val);
|
||||
|
||||
int32_t DefaultIntProperty();
|
||||
bool DefaultBoolProperty();
|
||||
double DefaultDoubleProperty();
|
||||
void DefaultIntProperty(int32_t val);
|
||||
void DefaultBoolProperty(bool val);
|
||||
void DefaultDoubleProperty(double val);
|
||||
};
|
||||
}
|
||||
|
||||
namespace winrt::BenchmarkComponent::factory_implementation
|
||||
{
|
||||
struct ClassWithMultipleInterfaces : ClassWithMultipleInterfacesT<ClassWithMultipleInterfaces, implementation::ClassWithMultipleInterfaces>
|
||||
{
|
||||
};
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
// Modern IDL 3.0: https://docs.microsoft.com/en-us/uwp/midl-3/intro
|
||||
|
||||
// BenchmarkComponent exercises indivdual isolated scenarios we want to benchmark in a WinRT projection.
|
||||
|
||||
namespace BenchmarkComponent
|
||||
{
|
||||
interface IIntProperties
|
||||
{
|
||||
Int32 IntProperty{ get; set; };
|
||||
}
|
||||
|
||||
interface IBoolProperties
|
||||
{
|
||||
Boolean BoolProperty{ get; set; };
|
||||
}
|
||||
|
||||
interface IDoubleProperties
|
||||
{
|
||||
Double DoubleProperty{ get; set; };
|
||||
}
|
||||
|
||||
// Class intended to help with benchmarking QueryInterface for the default and non default interfaces.
|
||||
[default_interface]
|
||||
runtimeclass ClassWithMultipleInterfaces :
|
||||
IIntProperties
|
||||
, IBoolProperties
|
||||
, IDoubleProperties
|
||||
{
|
||||
ClassWithMultipleInterfaces();
|
||||
|
||||
Int32 DefaultIntProperty{ get; set; };
|
||||
Boolean DefaultBoolProperty{ get; set; };
|
||||
Double DefaultDoubleProperty{ get; set; };
|
||||
}
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.200511.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200511.2\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<CppWinRTVerbosity>high</CppWinRTVerbosity>
|
||||
<CppWinRTOptimized>true</CppWinRTOptimized>
|
||||
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
|
||||
<ProjectGuid>{78d85f23-7cb1-44a1-9238-6df2c76754e4}</ProjectGuid>
|
||||
<ProjectName>BenchmarkComponent</ProjectName>
|
||||
<RootNamespace>BenchmarkComponent</RootNamespace>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<AppContainerApplication>true</AppContainerApplication>
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
||||
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformMinVersion>10.0.18362.0</WindowsTargetPlatformMinVersion>
|
||||
<_NoWinAPIFamilyApp>true</_NoWinAPIFamilyApp>
|
||||
<_VC_Target_Library_Platform>Desktop</_VC_Target_Library_Platform>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<ModuleDefinitionFile>BenchmarkComponent.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<RuntimeLibrary Condition="'$(Configuration)'=='Release'">MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="BenchmarkComponent.h">
|
||||
<DependentUpon>BenchmarkComponent.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BenchmarkComponent.cpp">
|
||||
<DependentUpon>BenchmarkComponent.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Midl Include="BenchmarkComponent.idl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="BenchmarkComponent.def" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.200511.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200511.2\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200511.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.200511.2\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200511.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.200511.2\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Resources">
|
||||
<UniqueIdentifier>accd3aa8-1ba0-4223-9bbe-0c431709210b</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Generated Files">
|
||||
<UniqueIdentifier>{926ab91d-31b4-48c3-b9a4-e681349f27f0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp" />
|
||||
<ClCompile Include="BenchmarkComponent.cpp" />
|
||||
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Midl Include="BenchmarkComponent.idl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="BenchmarkComponent.def" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.200511.2" targetFramework="native" />
|
||||
</packages>
|
|
@ -0,0 +1 @@
|
|||
#include "pch.h"
|
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
#include <unknwn.h>
|
||||
#include <winrt/Windows.Foundation.h>
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
14
Test.sln
14
Test.sln
|
@ -10,6 +10,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Console", "Console\Console.
|
|||
{2954F343-85A7-46F5-A3F3-F106FDD13900} = {2954F343-85A7-46F5-A3F3-F106FDD13900}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BenchmarkComponent", "BenchmarkComponent\BenchmarkComponent.vcxproj", "{78D85F23-7CB1-44A1-9238-6DF2C76754E4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM = Debug|ARM
|
||||
|
@ -42,6 +44,18 @@ Global
|
|||
{8AB80BFD-185A-452D-AAD2-97B38AED3E4B}.Release|x64.Build.0 = Release|x64
|
||||
{8AB80BFD-185A-452D-AAD2-97B38AED3E4B}.Release|x86.ActiveCfg = Release|Win32
|
||||
{8AB80BFD-185A-452D-AAD2-97B38AED3E4B}.Release|x86.Build.0 = Release|Win32
|
||||
{78D85F23-7CB1-44A1-9238-6DF2C76754E4}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{78D85F23-7CB1-44A1-9238-6DF2C76754E4}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{78D85F23-7CB1-44A1-9238-6DF2C76754E4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{78D85F23-7CB1-44A1-9238-6DF2C76754E4}.Debug|x64.Build.0 = Debug|x64
|
||||
{78D85F23-7CB1-44A1-9238-6DF2C76754E4}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{78D85F23-7CB1-44A1-9238-6DF2C76754E4}.Debug|x86.Build.0 = Debug|Win32
|
||||
{78D85F23-7CB1-44A1-9238-6DF2C76754E4}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{78D85F23-7CB1-44A1-9238-6DF2C76754E4}.Release|ARM.Build.0 = Release|ARM
|
||||
{78D85F23-7CB1-44A1-9238-6DF2C76754E4}.Release|x64.ActiveCfg = Release|x64
|
||||
{78D85F23-7CB1-44A1-9238-6DF2C76754E4}.Release|x64.Build.0 = Release|x64
|
||||
{78D85F23-7CB1-44A1-9238-6DF2C76754E4}.Release|x86.ActiveCfg = Release|Win32
|
||||
{78D85F23-7CB1-44A1-9238-6DF2C76754E4}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
Загрузка…
Ссылка в новой задаче