Crackerjack
Crackerjack

Reputation: 2154

Visual Studio 2008 - Get time interval between break points?

Does anyone know if you can get the time interval between break points in VS 2008? Plugin?, VS trick?

I DON'T want to add code to my existing source code to figure out how long something takes to run, I would like a quick and dirty way to get this while debugging. For you smart asses out there I know I can always whip out a stopwatch too, but I want something that is somewhat precise as well.

Upvotes: 9

Views: 5864

Answers (4)

Petter Nilsen
Petter Nilsen

Reputation: 476

Add two watches:

@clk
@clk = 0

The debugger evaluates them top to bottom, so @clk will show the time take on that debugger step, and @clk = 0 will reset it back to 0 again for the next step.

Upvotes: 6

Philip Wallace
Philip Wallace

Reputation: 8025

You could use a Tracepoint - which, when hit, will output what you entered to the console window:

alt text http://img24.imageshack.us/img24/3866/51292677.png

Then you can subtract the latter from the former to get the time between the two.

Upvotes: 18

Aaron
Aaron

Reputation: 9203

There are some useful tricks you can use in this regard with the @clk debug macro. It gives the current timestamp.

At the first breakpoint you add a watch of @clk=0. That resets it to zero. At the second breakpoint look at the value of @clk - it will be the duration since the first breakpoint.

Upvotes: 1

Ralf de Kleine
Ralf de Kleine

Reputation: 11756

Can't think of anything to do that, but maybe you can use the performance wizard to get some useful (timing) information. On the other hand you can print a message on each hit, you could print the current time.

Upvotes: 0

Related Questions