使用VS2010获取性能分析结果:C#API vs vsperfcmd

时间:2011-02-13 03:26:41

标签: visual-studio-2010 profiling code-coverage profiler

post包含有关如何将profiler作为以下批处理文件运行的信息

vsperfcmd /start:coverage /output:run.coverage
hello
vsperfcmd /shutdown

进入C#代码

 // A guid is used to keep track of the run
 Guid myrunguid = Guid.NewGuid();
 Monitor m = new Monitor();
 m.StartRunCoverage(myrunguid, "run.coverage");


 // TODO: Launch some tests or something
 // that can exercise myassembly.exe

 // Complete the run
 m.FinishRunCoverage(myrunguid);

对于TODO:部分,我使用了此代码

p = new Process();
p.StartInfo.FileName = "hello.exe";
p.Start();
p.WaitForExit();
// Look at return code – 0 for success
if (p.ExitCode != 0) {
    Console.Error.WriteLine("Error in profiling");
    System.Environment.Exit( -3 );
}

代码运行正常,但我无法使用运行批处理文件的配置结果。

这是运行包含所有信息的批处理文件的结果。

enter image description here

这是C#代码的结果,它没有配置文件信息,只有架构 enter image description here

可能出现什么问题?

1 个答案:

答案 0 :(得分:0)

我向MSDN Forums提出了同样的问题,似乎该方法不起作用。