简体   繁体   中英

.cpp compile time tracking in Visual Studio 2012

I have to track compile time of each .cpp in every project. Default time-tracking in VS can't be used for it because this tool tracks time for projects, not for every .cpp .

Have you any ideas how to do this?

This is actually not that difficult to do and is available in Visual Studio. It's an undocumented feature (figures....) but works nicely to report on individual compile times. Here's an example...

3>------ Build started: Project: SomeProject, Configuration: Debug x64 ------
3>  stdafx.cpp
3>  time(C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\c1xx.dll)=1.468s
3>  time(C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\c2.dll)=0.048s
3>  SortStringArray.cpp
3>  time(C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\c1xx.dll)=0.030s
3>  Registry.cpp
3>  time(C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\c1xx.dll)=0.026s
3>  PropertyRoot.cpp
3>  time(C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\c1xx.dll)=0.255s

To enable this feature, you need to add the undocumented compile switch /Bt to the C/C++ command line additional options for each project you'd like to track. For more information on what's available for timing, check out this VC++ Team Blog Post .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM