pro*_*eek 6 c++ profiling code-coverage visual-studio-2010
我有以下C++代码.
#include <iostream>
using namespace std;
int testfunction(int input)
{
if (input > 0) {
return 1;
}
else {
return 0;
}
}
int main()
{
testfunction(-1);
testfunction(1);
}
Run Code Online (Sandbox Code Playgroud)
我编译它来获得执行
cl /Zi hello.cpp -link /Profile
Run Code Online (Sandbox Code Playgroud)
然后,我检测执行并生成.coverage二进制文件.
vsinstr -coverage hello.exe
start vsperfmon -coverage -output:mytestrun.coverage
vsperfcmd -shutdown
Run Code Online (Sandbox Code Playgroud)
当我在VS2010中打开覆盖文件时,我的结果没有任何结果.

可能有什么问题?我按照这篇文章中的说明进行操作.
Chr*_*ich 12
您需要在监视器启动后运行程序:
> vsinstr /coverage hello.exe> start vsperfmon /coverage /output:mytestrun.coverage> hello.exe> vsperfcmd /shutdown当您运行步骤3时,您应该在vsperfmon.exe中看到hello.exe已启动的一些通知.
如果您计划进行多次测试运行,则只需执行步骤2-4.换句话说,您只需要在构建二进制文件后对其进行一次检测(步骤1).
| 归档时间: |
|
| 查看次数: |
6783 次 |
| 最近记录: |