Code samples for the C++ Build Insights SDK
Перейти к файлу
Kevin Cadieux 662a4fb745
Merge pull request #9 from mwallner/Typo-Fix
fix typo 'infomation' in comment
2021-10-06 23:26:48 -07:00
BottleneckCompileFinder Changes for feedback 2021-06-10 13:04:00 -07:00
FunctionBottlenecks Changes for feedback 2021-06-10 13:04:00 -07:00
LongCodeGenFinder Changes for feedback 2021-06-10 13:04:00 -07:00
LongHeaderUnitFinder Fix wstring issue and VS Project output directory location 2021-06-11 15:43:38 -07:00
LongModuleFinder Fix wstring issue and VS Project output directory location 2021-06-11 15:43:38 -07:00
LongPrecompiledHeaderFinder Fix wstring issue and VS Project output directory location 2021-06-11 15:43:38 -07:00
RecursiveTemplateInspector typo 2021-10-07 08:11:39 +02:00
TopHeaders Changes for feedback 2021-06-10 13:04:00 -07:00
.gitignore Adding templates sample. 2020-05-25 00:28:54 -07:00
CODE_OF_CONDUCT.md Initial CODE_OF_CONDUCT.md commit 2020-01-28 16:42:44 -08:00
LICENSE Initial LICENSE commit 2020-01-28 16:42:46 -08:00
README.md Update README with requirements for using LongModuleFinder, LongHeaderUnitFinder, and LongPrecompiledHeaderFinder 2021-06-02 10:03:28 -07:00
SECURITY.md Initial SECURITY.md commit 2020-01-28 16:42:47 -08:00
Samples.sln Find longest IFC creation times - finalized 2021-06-01 10:57:03 -07:00

README.md

page_type languages products description urlFragment
sample
C++
cpp-build-insights
This repository provides buildable and runnable samples for the C++ Build Insights SDK. Use it as a learning resource. cpp-build-insights-samples

C++ Build Insights SDK samples

License

This repository provides buildable and runnable samples for the C++ Build Insights SDK. Use it as a learning resource.

Contents

Sample Description
BottleneckCompileFinder Finds CL invocations that are bottlenecks and don't use /MP.
FunctionBottlenecks Prints a list of functions that are code generation bottlenecks within their CL or Link invocation.
LongCodeGenFinder Lists the functions that take more than 500 milliseconds to generate in your entire build.
RecursiveTemplateInspector Identifies costly recursive template instantiations.
TopHeaders Determines which headers you might want to precompile.
LongModuleFinder Identifies costly module interface IFC creation. Requires trace with code built using MSVC version 16.10 or later and using SDK version Microsoft.Cpp.BuildInsights 1.2.0 or later.
LongHeaderUnitFinder Identifies costly header unit IFC creation. Requires trace with code built using MSVC version 16.10 or later and using SDK version Microsoft.Cpp.BuildInsights 1.2.0 or later.
LongPrecompiledHeaderFinder Identifies costly precompiled header (PCH) IFC creation. Requires trace with code built using MSVC version 16.10 or later and using SDK version Microsoft.Cpp.BuildInsights 1.2.0 or later.

Prerequisites

In order to build and run the samples in this repository, you need:

  • Visual Studio 2017 and above.
  • Windows 8 and above.

Build steps

  1. Clone the repository on your machine.
  2. Open the Visual Studio solution file. Each sample is a separate project within the solution.
  3. All samples rely on the C++ Build Insights SDK NuGet package. Restore NuGet packages and accept the license for the SDK.
  4. Build the desired configuration for the samples that interest you. Available platforms are x86 and x64, and available configurations are Debug and Release.
  5. Samples will be built in their own directory following this formula: {RepositoryRoot}\out\{SampleName}.

Running the samples

  1. The samples require CppBuildInsights.dll and KernelTraceControl.dll to run. These files are available in the C++ Build Insights NuGet package. When building samples, these files are automatically copied next to them in their respective output directory. If you are going to move a sample around on your machine, please be sure to move these DLL's along with it.
  2. Collect a trace of the build you want to analyze with the sample. You can do this using two methods:
    1. Use vcperf:
      1. Open an elevated x64 Native Tools Command Prompt for VS 2019.
      2. Run the following command: vcperf /start MySessionName
      3. Build your project. You do not need to use the same command prompt for building.
      4. Run the following command: vcperf /stopnoanalyze MySessionName outputTraceFile.etl
    2. Programmatically: see the C++ Build Insights SDK documentation for details.
  3. Invoke the sample, passing your trace as the first parameter.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.