开发者

Getting profiling results with VS2010: C# API vs vsperfcmd

This post has the info about how to run profiler as the following batch file

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

into C# code

 // 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);

For the TODO: part, I used this code

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 );
}

The code runs fine, but I can't the profiled result I did with runn开发者_StackOverflow社区ing batch file.

This is the result from running batch file which has all the info.

Getting profiling results with VS2010: C# API vs vsperfcmd

This is the result from C# code which doesn't have profiled info, but only schema

Getting profiling results with VS2010: C# API vs vsperfcmd

What might be wrong?


I asked the same question to MSDN Forums, and it seems like the method doesn't work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜